diff options
| author | Jakob Kaivo <jkk@ung.org> | 2020-08-16 15:55:19 -0400 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2020-08-16 15:55:19 -0400 |
| commit | e223e635cc53fa11e473cdbc864eb69a3da5f290 (patch) | |
| tree | d481ca6fb0b7f4184f3ec259a6f9c37d76e56a26 /src/string/memcpy_s.c | |
| parent | 700fbd205a1a428677876d322606b9a354221892 (diff) | |
add skeleton of symbols from C11 LIB_EXT1
Diffstat (limited to 'src/string/memcpy_s.c')
| -rw-r--r-- | src/string/memcpy_s.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/string/memcpy_s.c b/src/string/memcpy_s.c new file mode 100644 index 00000000..366a879c --- /dev/null +++ b/src/string/memcpy_s.c @@ -0,0 +1,35 @@ +#include "string.h" +#include "sys/_nonstd_.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) +*/ |
