summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--include/strutils.h3
-rw-r--r--lib/strutils.c7
3 files changed, 11 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 9024809e7..df989efb5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -313,6 +313,7 @@ AC_CHECK_FUNCS([ \
lchown \
llseek \
lseek64 \
+ mempcpy \
nanosleep \
personality \
posix_fadvise \
diff --git a/include/strutils.h b/include/strutils.h
index 123907fc9..00598cf62 100644
--- a/include/strutils.h
+++ b/include/strutils.h
@@ -28,6 +28,9 @@ extern double strtod_or_err(const char *str, const char *errmesg);
extern long strtol_or_err(const char *str, const char *errmesg);
extern unsigned long strtoul_or_err(const char *str, const char *errmesg);
+#ifndef HAVE_MEMPCPY
+extern void *mempcpy(void *restrict dest, const void *restrict src, size_t n);
+#endif
#ifndef HAVE_STRNLEN
extern size_t strnlen(const char *s, size_t maxlen);
#endif
diff --git a/lib/strutils.c b/lib/strutils.c
index 5dda13805..2337b07b9 100644
--- a/lib/strutils.c
+++ b/lib/strutils.c
@@ -132,6 +132,13 @@ err:
return -1;
}
+#ifndef HAVE_MEMPCPY
+void *mempcpy(void *restrict dest, const void *restrict src, size_t n)
+{
+ return ((char *)memcpy(dest, src, n)) + n;
+}
+#endif
+
#ifndef HAVE_STRNLEN
size_t strnlen(const char *s, size_t maxlen)
{