blob: c722ba7d1cd08bd6267ed622aa5f55fb4a82e564 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include <string.h>
#include "_safety.h"
void *memccpy(void * restrict s1, const void * restrict s2, int c, size_t n)
{
SIGNAL_SAFE(0);
unsigned char *dst = s1;
const unsigned char *src = s2;
size_t i = 0;
ASSERT_NOOVERLAP(s1, s2, n);
for (i = 0; i < n; i++) {
dst[i] = src[i];
if (dst[i] == (unsigned char)c) {
return dst + i + 1;
}
}
return NULL;
}
__check_4(void *, 0, memccpy, void * restrict, const void * restrict, int, size_t)
/*
XOPEN(4)
*/
|