From eab799e6ddcd41179c3ca2a7bbb48628da03b53c Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 11 Mar 2014 20:32:40 +0000 Subject: Import mempcpy from gnulib --- include/mingw.h | 5 +++++ win32/Kbuild | 1 + win32/mempcpy.c | 26 ++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 win32/mempcpy.c diff --git a/include/mingw.h b/include/mingw.h index ede7a72f5..c405c4a97 100644 --- a/include/mingw.h +++ b/include/mingw.h @@ -173,6 +173,11 @@ void unsetenv(const char *env); #define getenv mingw_getenv #define mktemp mingw_mktemp +/* + * string.h + */ +void *mempcpy(void *dest, const void *src, size_t n); + /* * sys/ioctl.h */ diff --git a/win32/Kbuild b/win32/Kbuild index c1005bd11..d82a9bfff 100644 --- a/win32/Kbuild +++ b/win32/Kbuild @@ -14,6 +14,7 @@ lib-$(CONFIG_WIN32_NET) += net.o lib-$(CONFIG_PLATFORM_MINGW32) += poll.o lib-$(CONFIG_PLATFORM_MINGW32) += popen.o lib-$(CONFIG_PLATFORM_MINGW32) += statfs.o +lib-$(CONFIG_PLATFORM_MINGW32) += mempcpy.o lib-$(CONFIG_PLATFORM_MINGW32) += mntent.o lib-$(CONFIG_PLATFORM_MINGW32) += strptime.o lib-$(CONFIG_PLATFORM_MINGW32) += system.o diff --git a/win32/mempcpy.c b/win32/mempcpy.c new file mode 100644 index 000000000..81fc88f61 --- /dev/null +++ b/win32/mempcpy.c @@ -0,0 +1,26 @@ +/* Copy memory area and return pointer after last written byte. + Copyright (C) 2003, 2007, 2009-2014 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . */ + +/* Specification. */ +#include + +/* Copy N bytes of SRC to DEST, return pointer to bytes after the + last written byte. */ +void * +mempcpy (void *dest, const void *src, size_t n) +{ + return (char *) memcpy (dest, src, n) + n; +} -- cgit v1.2.3-55-g6feb