[PATCH 2/3] platform: fix missing mempcpy
Daniel Borca
dborca at yahoo.com
Wed Nov 27 01:28:18 UTC 2013
Yes, my bad. Resubmitted.
Denys Vlasenko wrote:
> On Tuesday 26 November 2013 20:56, Daniel Borca wrote:
>> mempcpy() is a GNU extension
>>
>> I chose to inline this one because most compilers inline memcpy as well.
>
> Please also *test* the patch ;)
>
> memcpy(dest, src) won't compile.
-dborca
-------------- next part --------------
Signed-off-by: Daniel Borca <dborca at yahoo.com>
---
include/platform.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/include/platform.h b/include/platform.h
index cfc8029..18b09e5 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -361,6 +361,7 @@ typedef unsigned smalluint;
#define HAVE_CLEARENV 1
#define HAVE_FDATASYNC 1
#define HAVE_DPRINTF 1
+#define HAVE_MEMPCPY 1
#define HAVE_MEMRCHR 1
#define HAVE_MKDTEMP 1
#define HAVE_PTSNAME_R 1
@@ -435,6 +436,7 @@ typedef unsigned smalluint;
#endif
#if defined(__FreeBSD__) || defined(__APPLE__)
+# undef HAVE_MEMPCPY
# undef HAVE_STRCHRNUL
#endif
@@ -465,6 +467,13 @@ typedef unsigned smalluint;
extern int dprintf(int fd, const char *format, ...);
#endif
+#ifndef HAVE_MEMPCPY
+static ALWAYS_INLINE void *mempcpy(void *dest, const void *src, size_t n)
+{
+ return (char *)memcpy(dest, src, n) + n;
+}
+#endif
+
#ifndef HAVE_MEMRCHR
extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC;
#endif
--
1.7.4.4
More information about the busybox
mailing list