[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH 2/3] platform: fix missing mempcpy
From: Daniel Borca <dborca () yahoo ! com>
Date: 2013-11-27 1:28:18
Message-ID: 52954AB2.7090105 () yahoo ! com
[Download RAW message or body]
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
["03-missing-mempcpy.patch" (text/plain)]
Signed-off-by: Daniel Borca <dborca@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
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic