From: Eric Biggers Date: Fri, 16 Aug 2013 23:46:28 +0000 (-0500) Subject: Replace mempcpy() if not implemented X-Git-Tag: v1.5.0~63 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=0a859cd076a942d7145e203c596892ca66f7e4a2 Replace mempcpy() if not implemented --- diff --git a/configure.ac b/configure.ac index 8d96cc37..84c397a3 100644 --- a/configure.ac +++ b/configure.ac @@ -48,7 +48,7 @@ AC_PROG_CC AM_PROG_CC_C_O AC_CANONICAL_HOST -AC_CHECK_FUNCS([utimensat lutimes utime flock]) +AC_CHECK_FUNCS([utimensat lutimes utime flock mempcpy]) # Note: some of the following header checks are only to define the appropriate # HAVE_*_H macro so that the NTFS-3g headers don't get confused and try to skip diff --git a/include/wimlib/util.h b/include/wimlib/util.h index 7b3e724a..7bc8359c 100644 --- a/include/wimlib/util.h +++ b/include/wimlib/util.h @@ -90,6 +90,11 @@ wimlib_strdup(const char *str) _malloc_attribute; extern void * memdup(const void *mem, size_t size) _malloc_attribute; +#ifndef HAVE_MEMPCPY +extern void * +mempcpy(void *dst, const void *src, size_t n); +#endif + /* util.c */ extern void randomize_byte_array(u8 *p, size_t n); diff --git a/src/lookup_table.c b/src/lookup_table.c index f5bd9aaa..7441932c 100644 --- a/src/lookup_table.c +++ b/src/lookup_table.c @@ -918,13 +918,6 @@ wimlib_iterate_lookup_table(WIMStruct *wim, int flags, return for_lookup_table_entry(wim->lookup_table, do_iterate_lte, &ctx); } -static int -do_print_lookup_table_entry(struct wim_lookup_table_entry *lte, void *fp) -{ - print_lookup_table_entry(lte, (FILE*)fp); - return 0; -} - /* Given a SHA1 message digest, return the corresponding entry in the WIM's * lookup table, or NULL if there is none. */ struct wim_lookup_table_entry * diff --git a/src/util.c b/src/util.c index 27e15acf..640f8b32 100644 --- a/src/util.c +++ b/src/util.c @@ -576,3 +576,10 @@ void print_byte_field(const u8 field[], size_t len, FILE *out) while (len--) tfprintf(out, T("%02hhx"), *field++); } + +#ifndef HAVE_MEMPCPY +void *mempcpy(void *dst, const void *src, size_t n) +{ + return memcpy(dst, src, n) + n; +} +#endif