diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gnulib.mk.in | 12 | ||||
| -rw-r--r-- | lib/mempcpy.c | 28 |
2 files changed, 40 insertions, 0 deletions
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 9a2709c22a7..8e3b569b94f 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in | |||
| @@ -116,6 +116,7 @@ | |||
| 116 | # lstat \ | 116 | # lstat \ |
| 117 | # manywarnings \ | 117 | # manywarnings \ |
| 118 | # memmem-simple \ | 118 | # memmem-simple \ |
| 119 | # mempcpy \ | ||
| 119 | # memrchr \ | 120 | # memrchr \ |
| 120 | # minmax \ | 121 | # minmax \ |
| 121 | # mkostemp \ | 122 | # mkostemp \ |
| @@ -2027,6 +2028,17 @@ EXTRA_libgnu_a_SOURCES += memmem.c | |||
| 2027 | endif | 2028 | endif |
| 2028 | ## end gnulib module memmem-simple | 2029 | ## end gnulib module memmem-simple |
| 2029 | 2030 | ||
| 2031 | ## begin gnulib module mempcpy | ||
| 2032 | ifeq (,$(OMIT_GNULIB_MODULE_mempcpy)) | ||
| 2033 | |||
| 2034 | |||
| 2035 | EXTRA_DIST += mempcpy.c | ||
| 2036 | |||
| 2037 | EXTRA_libgnu_a_SOURCES += mempcpy.c | ||
| 2038 | |||
| 2039 | endif | ||
| 2040 | ## end gnulib module mempcpy | ||
| 2041 | |||
| 2030 | ## begin gnulib module memrchr | 2042 | ## begin gnulib module memrchr |
| 2031 | ifeq (,$(OMIT_GNULIB_MODULE_memrchr)) | 2043 | ifeq (,$(OMIT_GNULIB_MODULE_memrchr)) |
| 2032 | 2044 | ||
diff --git a/lib/mempcpy.c b/lib/mempcpy.c new file mode 100644 index 00000000000..d0220e10fb0 --- /dev/null +++ b/lib/mempcpy.c | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | /* Copy memory area and return pointer after last written byte. | ||
| 2 | Copyright (C) 2003, 2007, 2009-2019 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This program is free software; you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation; either version 3, or (at your option) | ||
| 7 | any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program; if not, see <https://www.gnu.org/licenses/>. */ | ||
| 16 | |||
| 17 | #include <config.h> | ||
| 18 | |||
| 19 | /* Specification. */ | ||
| 20 | #include <string.h> | ||
| 21 | |||
| 22 | /* Copy N bytes of SRC to DEST, return pointer to bytes after the | ||
| 23 | last written byte. */ | ||
| 24 | void * | ||
| 25 | mempcpy (void *dest, const void *src, size_t n) | ||
| 26 | { | ||
| 27 | return (char *) memcpy (dest, src, n) + n; | ||
| 28 | } | ||