Mercurial > hg > octave-lyh > gnulib-hg
changeset 4436:d556daa10e53
New module 'mempcpy'.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 14 Jul 2003 18:50:59 +0000 |
parents | d4efdb886b2a |
children | 19e3ac1521d6 |
files | ChangeLog lib/ChangeLog lib/mempcpy.c lib/mempcpy.h m4/ChangeLog m4/mempcpy.m4 modules/mempcpy |
diffstat | 7 files changed, 119 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-07-14 Simon Josefsson <jas@extundo.com> + + * modules/mempcpy: New file. + * MODULES.html.sh (func_all_modules): Add mempcpy. + 2003-07-14 Paul Eggert <eggert@twinsun.com> * modules/getdate, modules/posixtm: Depend on mktime.
--- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2003-07-14 Simon Josefsson <jas@extundo.com> + + * mempcpy.h: New file. + * mempcpy.c: New file. + 2003-07-14 Paul Eggert <eggert@twinsun.com> * ceill.c, expl.c, floorl.c, frexpl.c, ldexpl.c, mathl.h,
new file mode 100644 --- /dev/null +++ b/lib/mempcpy.c @@ -0,0 +1,29 @@ +/* Copy memory area and return pointer after last written byte. + Copyright (C) 2003 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, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Specification. */ +#include "mempcpy.h" + +#include <string.h> + +/* 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; +}
new file mode 100644 --- /dev/null +++ b/lib/mempcpy.h @@ -0,0 +1,32 @@ +/* Copy memory area and return pointer after last written byte. + Copyright (C) 2003 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, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#if HAVE_MEMPCPY + +/* Get mempcpy() declaration. */ +#include <string.h> + +#else + +/* Get size_t */ +#include <stddef.h> + +/* Copy N bytes of SRC to DEST, return pointer to bytes after the + last written byte. */ +extern void *mempcpy (void *dest, const void *src, size_t n); + +#endif
--- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,7 @@ +2003-07-14 Simon Josefsson <jas@extundo.com> + + * mempcpy.m4: New file. + 2003-07-10 Jim Meyering <jim@meyering.net> * clock_time.m4: Remove trailing blank.
new file mode 100644 --- /dev/null +++ b/m4/mempcpy.m4 @@ -0,0 +1,23 @@ +# mempcpy.m4 serial 1 +dnl Copyright (C) 2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +AC_DEFUN([gl_FUNC_MEMPCPY], +[ + dnl Persuade glibc <string.h> to declare mempcpy(). + AC_REQUIRE([AC_GNU_SOURCE]) + + AC_REPLACE_FUNCS(mempcpy) + if test $ac_cv_func_mempcpy = no; then + gl_PREREQ_MEMPCPY + fi +]) + +# Prerequisites of lib/mempcpy.c. +AC_DEFUN([gl_PREREQ_MEMPCPY], [ + : +])
new file mode 100644 --- /dev/null +++ b/modules/mempcpy @@ -0,0 +1,21 @@ +Description: +mempcpy() function: copy memory area, return point after last written byte. + +Files: +lib/mempcpy.h +lib/mempcpy.c +m4/mempcpy.m4 + +Depends-on: + +configure.ac: +gl_FUNC_MEMPCPY + +Makefile.am: +lib_SOURCES += mempcpy.h + +Include: +"mempcpy.h" + +Maintainer: +Simon Josefsson