]> xenbits.xensource.com Git - people/royger/xen-test-framework.git/commitdiff
Add memcpy() to the framework's libc implementation
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 21 Mar 2016 14:51:17 +0000 (14:51 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 21 Mar 2016 17:55:37 +0000 (17:55 +0000)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
common/libc/string.c
include/xtf/libc.h

index 59e087f2e89da9d9e3e0f755b6723dc910102566..b134b6c508e58d96c7a62627ce1deb9a1b79160d 100644 (file)
@@ -30,6 +30,17 @@ void *memset(void *s, int c, size_t n)
     return s;
 }
 
+void *memcpy(void *_d, const void *_s, size_t n)
+{
+    char *d = _d;
+    const char *s = _s;
+
+    for ( ; n; --n )
+        *d++ = *s++;
+
+    return _d;
+}
+
 int memcmp(const void *s1, const void *s2, size_t n)
 {
     const unsigned char *u1 = s1, *u2 = s2;
index dc9256a27be53b93c8319028808120d37bd25e29..65ea6c8ed40daea73c2916f3d8665aba3f028ffe 100644 (file)
 
 #define strlen(s)                   __builtin_strlen(s)
 #define memset(d, c, n)             __builtin_memset(d, c, n)
+#define memcpy(d, s, n)             __builtin_memcpy(d, s, n)
 #define memcmp(s1, s2, n)           __builtin_memcmp(s1, s2, n)
 
 size_t strlen(const char *str);
 size_t strnlen(const char *str, size_t max);
 void *memset(void *s, int c, size_t n);
+void *memcpy(void *dst, const void *src, size_t n);
 int memcmp(const void *s1, const void *s2, size_t n);
 
 int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);