changeset 5326:6523edcee696

Don't redeclare strsep if the system already has it.
author Bruno Haible <bruno@clisp.org>
date Tue, 05 Oct 2004 17:44:44 +0000
parents 029ddd263b1f
children 31a3d72751e2
files lib/ChangeLog lib/strsep.h m4/ChangeLog m4/strsep.m4
diffstat 4 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,7 @@
+2004-10-05  Bruno Haible  <bruno@clisp.org>
+
+	* strsep.h: Don't declare strsep() if HAVE_STRSEP.
+
 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* xalloc.h (xmemdup): Renamed from xclone.  All uses changed.
--- a/lib/strsep.h
+++ b/lib/strsep.h
@@ -20,11 +20,15 @@
 #ifndef GNULIB_STRSEP_H_
 #define GNULIB_STRSEP_H_
 
+#if HAVE_STRSEP
+
 /*
- * Get strsep, if available.
+ * Get strsep() declaration.
  */
 #include <string.h>
 
+#else
+
 /* Searches the next delimiter (char listed in DELIM) starting at *STRINGP.
    If one is found, it is overwritten with a NUL, and *STRINGP is advanced
    to point to the next char after it.  Otherwise, *STRINGP is set to NULL.
@@ -40,4 +44,6 @@
 
 extern char *strsep (char **stringp, const char *delim);
 
+#endif
+
 #endif /* GNULIB_STRSEP_H_ */
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,8 @@
+2004-10-05  Bruno Haible  <bruno@clisp.org>
+
+	* strsep.m4 (gl_FUNC_STRSEP): Require AC_GNU_SOURCE. Don't check
+	for the declaration of strsep.
+
 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* xalloc.m4 (gl_PREREQ_XSTRDUP): Remove.  All uses removed.
--- a/m4/strsep.m4
+++ b/m4/strsep.m4
@@ -1,4 +1,4 @@
-# strsep.m4 serial 1
+# strsep.m4 serial 2
 dnl Copyright (C) 2002, 2003, 2004 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
@@ -8,8 +8,10 @@
 
 AC_DEFUN([gl_FUNC_STRSEP],
 [
+  dnl Persuade glibc <string.h> to declare strsep().
+  AC_REQUIRE([AC_GNU_SOURCE])
+
   AC_REPLACE_FUNCS(strsep)
-  AC_CHECK_DECLS_ONCE(strsep)
   gl_PREREQ_STRSEP
 ])