diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2017-02-16 10:10:30 +0100 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2017-02-17 10:45:39 +0100 |
commit | b3248e684cedf66239710a5f16a6b45294f183bc (patch) | |
tree | f8184f18599492e9d8f2727d3a5fba005429578b /lib | |
parent | cb379c4d7859848572c224f7bebd107b02adcfd6 (diff) | |
download | elfutils-b3248e684cedf66239710a5f16a6b45294f183bc.tar.gz |
Check for existence of mempcpy
If it doesn't exist, provide a definition based on memcpy.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ChangeLog | 5 | ||||
-rw-r--r-- | lib/system.h | 5 | ||||
-rw-r--r-- | lib/xstrndup.c | 2 |
3 files changed, 11 insertions, 1 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index 6578ddba..fd63e039 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,5 +1,10 @@ 2017-02-15 Ulf Hermann <ulf.hermann@qt.io> + * system.h: Provide mempcpy if it doesn't exist. + * xstrndup.c: Include system.h. + +2017-02-15 Ulf Hermann <ulf.hermann@qt.io> + * crc32_file.c: Use _SC_PAGESIZE rather than _SC_PAGE_SIZE. 2017-02-14 Ulf Hermann <ulf.hermann@qt.io> diff --git a/lib/system.h b/lib/system.h index dde7c4a2..429b0c33 100644 --- a/lib/system.h +++ b/lib/system.h @@ -68,6 +68,11 @@ #define powerof2(x) (((x) & ((x) - 1)) == 0) #endif +#if !HAVE_DECL_MEMPCPY +#define mempcpy(dest, src, n) \ + ((void *) ((char *) memcpy (dest, src, n) + (size_t) n)) +#endif + /* A special gettext function we use if the strings are too short. */ #define sgettext(Str) \ ({ const char *__res = strrchr (gettext (Str), '|'); \ diff --git a/lib/xstrndup.c b/lib/xstrndup.c index d43e3b9e..a257aa9a 100644 --- a/lib/xstrndup.c +++ b/lib/xstrndup.c @@ -33,7 +33,7 @@ #include <stdint.h> #include <string.h> #include "libeu.h" - +#include "system.h" /* Return a newly allocated copy of STRING. */ char * |