[hackers] [scc] [libc] Add memcpy() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 16 Feb 2017 22:51:16 +0100 (CET)

commit 673610fb8b9defeab63b90549251dfc885fa152d
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Feb 16 22:48:02 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Feb 16 22:50:47 2017 +0100

    [libc] Add memcpy()

diff --git a/libc/src/Makefile b/libc/src/Makefile
index 4b0863c..0e0d23e 100644
--- a/libc/src/Makefile
+++ b/libc/src/Makefile
_AT_@ -3,7 +3,7 @@
 
 LIBCOBJ = assert.o strcpy.o strcmp.o strlen.o strchr.o \
           strrchr.o strcat.o strncpy.o strncat.o \
- memset.o
+ memset.o memcpy.o
 
 all: libc.a
 
diff --git a/libc/src/memcpy.c b/libc/src/memcpy.c
new file mode 100644
index 0000000..88a74d4
--- /dev/null
+++ b/libc/src/memcpy.c
_AT_@ -0,0 +1,13 @@
+/* See LICENSE file for copyright and license details. */
+
+#include <string.h>
+
+void *
+memcpy(void *dst, const void *src, size_t n)
+{
+ char *s1 = dst, *s2 = (char *) src;
+
+ while (n-- > 0)
+ *s1++ = *s2++;
+ return dst;
+}
Received on Thu Feb 16 2017 - 22:51:16 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 16 2017 - 23:00:27 CET