Add memcpy(void *dest, const void *src, size_t n) to lib/string.c. This function acts the same as memcpy in libc. Signed-off-by: Arthur Chunqi Li <yzt356@xxxxxxxxx> --- lib/libcflat.h | 1 + lib/string.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/libcflat.h b/lib/libcflat.h index 0875bd9..fadc33d 100644 --- a/lib/libcflat.h +++ b/lib/libcflat.h @@ -50,6 +50,7 @@ extern int vsnprintf(char *buf, int size, const char *fmt, va_list va); extern void puts(const char *s); extern void *memset(void *s, int c, size_t n); +extern void *memcpy(void *dest, const void *src, size_t n); extern long atol(const char *ptr); #define ARRAY_SIZE(_a) (sizeof(_a)/sizeof((_a)[0])) diff --git a/lib/string.c b/lib/string.c index 9dc94a1..e798f86 100644 --- a/lib/string.c +++ b/lib/string.c @@ -42,6 +42,18 @@ void *memset(void *s, int c, size_t n) return s; } +void *memcpy(void *dest, const void *src, size_t n) +{ + size_t i; + char *a = dest; + char *b = src; + + for (i = 0; i < n; ++i) + a[i] = b[i]; + + return dest; +} + long atol(const char *ptr) { long acc = 0; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html