maximilian attems
2011-Aug-29 14:36 UTC
[klibc] [PATCH] Add mempcpy() as wrapper around memcpy
Newer udev versions asks for it: libudev/libudev-util.c:168:12: warning: incompatible implicit declaration of built-in function 'mempcpy' [enabled by default] Signed-off-by: maximilian attems <max at stro.at> --- usr/include/string.h | 1 + usr/klibc/Kbuild | 2 +- usr/klibc/mempcpy.c | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletions(-) create mode 100644 usr/klibc/mempcpy.c diff --git a/usr/include/string.h b/usr/include/string.h index 0c8c046..270fddd 100644 --- a/usr/include/string.h +++ b/usr/include/string.h @@ -13,6 +13,7 @@ __extern void *memchr(const void *, int, size_t); __extern void *memrchr(const void *, int, size_t); __extern int memcmp(const void *, const void *, size_t); __extern void *memcpy(void *, const void *, size_t); +__extern void *mempcpy(void *, const void *, size_t); __extern void *memmove(void *, const void *, size_t); __extern void *memset(void *, int, size_t); __extern void *memmem(const void *, size_t, const void *, size_t); diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild index c4f9ae2..d024f31 100644 --- a/usr/klibc/Kbuild +++ b/usr/klibc/Kbuild @@ -29,7 +29,7 @@ klib-y := vsnprintf.o snprintf.o vsprintf.o sprintf.o \ pselect.o ppoll.o \ brk.o sbrk.o malloc.o realloc.o calloc.o \ mmap.o shm_open.o shm_unlink.o \ - memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ + memcpy.o mempcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ memmove.o memchr.o memrchr.o bzero.o \ strcasecmp.o strncasecmp.o strndup.o strerror.o strsignal.o \ strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o strnlen.o \ diff --git a/usr/klibc/mempcpy.c b/usr/klibc/mempcpy.c new file mode 100644 index 0000000..ff3770a --- /dev/null +++ b/usr/klibc/mempcpy.c @@ -0,0 +1,7 @@ +#include <string.h> + +void *mempcpy(void *dst, const void *src, size_t len) +{ + return (char *) memcpy(dst, src, len) + len; + +} -- 1.7.5.4