summaryrefslogtreecommitdiff
path: root/src/string/memcpy_s.c
blob: 2d30921b4ea10e3e21b1a95b28702ee4ddd1390e (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
29
30
31
32
33
34
35
36
37
38
39
40
#if 0

#include <string.h>
#include "_assert.h"

/** copy memory **/
errno_t memcpy_s(void * restrict s1, rsize_t s1max, const void * restrict s2, rsize_t n)
{
	__C_EXT(1, 201112L);
	__ASSERT_NONNULL(s1);
	__ASSERT_NONNULL(s2);
	__ASSERT_NOOVERLAP(s1, s2, n);

	char *dst = (char*)s1, *src = (char*)s2;
	int i = 0;
	while (i < n) {
		dst[i] = src[i];
		i++;
	}
	return dst;
}

/***
The fn(memcpy) copies arg(n) bytes from the object at arg(s2) to the object at
arg(s1).
***/

/* UNSPECIFIED: - */
/* UNDEFINED: if the objects overlap */
/* IMPLEMENTATION: - */
/* LOCALE: - */

/* RETURN: the value of arg(s1) */

/*
CEXT1(201112)
*/


#endif