Mercurial > hg > octave-lyh > gnulib-hg
changeset 5637:2b20ff1c4169
* modules/chdir-long (Depends-on): Add memrchr.
* modules/memrchr (Files): Add lib/memrchr.h.
(Include): "memrchr.h".
* lib/memrchr.h: New file.
* lib/chdir-long.c: Include it.
* lib/memrchr.c [!defined _LIBC]: Include it rather than <string.h>
Don't bother including stddef.h.
* m4/memrchr.m4 (gl_FUNC_MEMRCHR): Add AC_LIBSOURCES, for memrchr.h.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Thu, 03 Feb 2005 20:38:14 +0000 |
parents | 8f9989f07be0 |
children | ef47f86f7ce5 |
files | ChangeLog lib/ChangeLog lib/chdir-long.c lib/memrchr.c lib/memrchr.h m4/ChangeLog m4/memrchr.m4 modules/chdir-long modules/memrchr |
diffstat | 9 files changed, 56 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-02-03 Paul Eggert <eggert@cs.ucla.edu> + + * modules/chdir-long (Depends-on): Add memrchr. + * modules/memrchr (Files): Add lib/memrchr.h. + (Include): "memrchr.h". + 2005-01-28 Paul Eggert <eggert@cs.ucla.edu> Sync from coreutils.
--- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,10 @@ +2005-02-03 Paul Eggert <eggert@cs.ucla.edu> + + * memrchr.h: New file. + * chdir-long.c: Include it. + * memrchr.c [!defined _LIBC]: Include it rather than <string.h> + Don't bother including stddef.h. + 2005-02-03 Sergey Poznyakoff <gray@Mirddin.farlep.net> * argp-help.c (__argp_help): Create a fake struct argp_state and
--- a/lib/chdir-long.c +++ b/lib/chdir-long.c @@ -30,6 +30,7 @@ #include <assert.h> #include <limits.h> +#include "memrchr.h" #include "openat.h" #ifndef O_DIRECTORY
--- a/lib/memrchr.c +++ b/lib/memrchr.c @@ -1,7 +1,7 @@ /* memrchr -- find the last occurrence of a byte in a memory block - Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004 Free - Software Foundation, Inc. + Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004, 2005 + Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), with help from Dan Sahlin (dan@sics.se) and @@ -27,13 +27,11 @@ # include <config.h> #endif -#include <string.h> - -#include <stddef.h> - #if defined _LIBC +# include <string.h> # include <memcopy.h> #else +# include "memrchr.h" # define reg_char char #endif
new file mode 100644 --- /dev/null +++ b/lib/memrchr.h @@ -0,0 +1,27 @@ +/* memrchr -- Find the last occurrence of a byte in a memory block. + + Copyright (C) 2005 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_DECL_MEMRCHR +# include <string.h> +#else +# include <stddef.h> + +/* Search backwards through a block for a byte (specified as an int). */ +void *memrchr (void const *, int, size_t); + +#endif
--- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,7 @@ +2005-02-03 Paul Eggert <eggert@cs.ucla.edu> + + * memrchr.m4 (gl_FUNC_MEMRCHR): Add AC_LIBSOURCES, for memrchr.h. + 2005-01-28 Paul Eggert <eggert@cs.ucla.edu> Sync from coreutils.
--- a/m4/memrchr.m4 +++ b/m4/memrchr.m4 @@ -1,11 +1,13 @@ -# memrchr.m4 serial 3 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# memrchr.m4 serial 4 +dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MEMRCHR], [ + AC_LIBSOURCES([memrchr.c, memrchr.h]) + dnl Persuade glibc <string.h> to declare memrchr(). AC_REQUIRE([AC_GNU_SOURCE])