From: Bruno Haible Date: Sun, 31 Jan 2021 11:42:21 +0000 (+0100) Subject: Make it possible to compile mempcpy.c separately, unconditionally. X-Git-Tag: v1.0~3110 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=9c86ea67f0b554284251bbe325db033cfe4a8368;p=gnulib.git Make it possible to compile mempcpy.c separately, unconditionally. * lib/mempcpy.c: Don't define mempcpy if not needed. --- diff --git a/ChangeLog b/ChangeLog index b8d5cd743c..3e74dc5764 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2021-01-31 Bruno Haible + Make it possible to compile mempcpy.c separately, unconditionally. + * lib/mempcpy.c: Don't define mempcpy if not needed. + Make it possible to compile free.c separately, unconditionally. * m4/free.m4 (gl_FUNC_FREE): Define HAVE_FREE_POSIX. * lib/free.c: Don't define rpl_free if not needed. diff --git a/lib/mempcpy.c b/lib/mempcpy.c index c61132e64a..6e9500c95a 100644 --- a/lib/mempcpy.c +++ b/lib/mempcpy.c @@ -19,6 +19,9 @@ /* Specification. */ #include +/* A function definition is only needed if HAVE_MEMPCPY is not defined. */ +#if !HAVE_MEMPCPY + /* Copy N bytes of SRC to DEST, return pointer to bytes after the last written byte. */ void * @@ -26,3 +29,5 @@ mempcpy (void *dest, const void *src, size_t n) { return (char *) memcpy (dest, src, n) + n; } + +#endif