bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnulib] memrchr use in chdir-long


From: Paul Eggert
Subject: Re: [bug-gnulib] memrchr use in chdir-long
Date: Thu, 03 Feb 2005 12:42:06 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

In the long run it'd be nice to have a better solution for this sort
of problem, but in the short run we might as well use the same
solution here that we've used elsewhere, so I installed this fix for
the specific issue noted by Eric Blake (which occurs on Solaris as
well as Cygwin).

2005-02-03  Paul Eggert  <address@hidden>

        * 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.

--- /dev/null   2003-03-18 13:55:57 -0800
+++ lib/memrchr.h       2005-02-03 12:28:28 -0800
@@ -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
Index: lib/chdir-long.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/chdir-long.c,v
retrieving revision 1.2
diff -p -u -r1.2 chdir-long.c
--- lib/chdir-long.c    22 Jan 2005 05:37:06 -0000      1.2
+++ lib/chdir-long.c    3 Feb 2005 20:32:42 -0000
@@ -30,6 +30,7 @@
 #include <assert.h>
 #include <limits.h>
 
+#include "memrchr.h"
 #include "openat.h"
 
 #ifndef O_DIRECTORY
Index: lib/memrchr.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/memrchr.c,v
retrieving revision 1.5
diff -p -u -r1.5 memrchr.c
--- lib/memrchr.c       7 Aug 2004 00:09:39 -0000       1.5
+++ lib/memrchr.c       3 Feb 2005 20:32:42 -0000
@@ -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 (address@hidden),
    with help from Dan Sahlin (address@hidden) 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
 
Index: m4/memrchr.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/memrchr.m4,v
retrieving revision 1.3
diff -p -u -r1.3 memrchr.m4
--- m4/memrchr.m4       23 Jan 2005 08:06:57 -0000      1.3
+++ m4/memrchr.m4       3 Feb 2005 20:32:43 -0000
@@ -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])
 
Index: modules/chdir-long
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/chdir-long,v
retrieving revision 1.2
diff -p -u -r1.2 chdir-long
--- modules/chdir-long  22 Jan 2005 05:37:06 -0000      1.2
+++ modules/chdir-long  3 Feb 2005 20:32:43 -0000
@@ -8,6 +8,7 @@ m4/chdir-long.m4
 
 Depends-on:
 openat
+memrchr
 
 configure.ac:
 gl_FUNC_CHDIR_LONG
Index: modules/memrchr
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/memrchr,v
retrieving revision 1.4
diff -p -u -r1.4 memrchr
--- modules/memrchr     22 Sep 2004 15:11:04 -0000      1.4
+++ modules/memrchr     3 Feb 2005 20:32:43 -0000
@@ -3,6 +3,7 @@ memrchr() function: scan memory for a by
 
 Files:
 lib/memrchr.c
+lib/memrchr.h
 m4/memrchr.m4
 
 Depends-on:
@@ -13,10 +14,10 @@ gl_FUNC_MEMRCHR
 Makefile.am:
 
 Include:
+"memrchr.h"
 
 License:
 LGPL
 
 Maintainer:
 Jim Meyering, glibc
-




reply via email to

[Prev in Thread] Current Thread [Next in Thread]