changeset 8060:aa9210dfec71

* lib/string_.h: If the gnulib module XYZ is not present, undefine the symbol XYZ before redefining it. This fixes a problem with programs that don't use XYZ, when compiled on systems that define XYZ to something else.
author Paul Eggert <eggert@cs.ucla.edu>
date Thu, 01 Feb 2007 08:57:49 +0000
parents 5cac1cb7921e
children 0e706cb0061d
files ChangeLog lib/string_.h
diffstat 2 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-02-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* lib/string_.h: If the gnulib module XYZ is not present, undefine
+	the symbol XYZ before redefining it.  This fixes a problem with
+	programs that don't use XYZ, when compiled on systems that define
+	XYZ to something else.
+
 2007-01-31  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* lib/mkdir-p.c (make_dir_parents): Close a race condition that
--- a/lib/string_.h
+++ b/lib/string_.h
@@ -32,6 +32,7 @@
 		     void const *__needle, size_t __needle_len);
 # endif
 #else
+# undef memmem
 # define memmem memmem_is_unportable__use_gnulib_module_memmem_for_portability
 #endif
 
@@ -43,6 +44,7 @@
 		      size_t __n);
 # endif
 #else
+# undef mempcpy
 # define mempcpy mempcpy_is_unportable__use_gnulib_module_mempcpy_for_portability
 #endif
 
@@ -52,6 +54,7 @@
 extern void *memrchr (void const *, int, size_t);
 # endif
 #else
+# undef memrchr
 # define memrchr memrchr_is_unportable__use_gnulib_module_memrchr_for_portability
 #endif
 
@@ -61,6 +64,7 @@
 extern char *stpcpy (char *restrict __dst, char const *restrict __src);
 # endif
 #else
+# undef stpcpy
 # define stpcpy stpcpy_is_unportable__use_gnulib_module_stpcpy_for_portability
 #endif
 
@@ -73,6 +77,7 @@
 		      size_t __n);
 # endif
 #else
+# undef stpncpy
 # define stpncpy stpncpy_is_unportable__use_gnulib_module_stpncpy_for_portability
 #endif
 
@@ -90,6 +95,7 @@
 extern int strcasecmp (char const *__s1, char const *__s2);
 # endif
 #else
+# undef strcasecmp
 # define strcasecmp strcasecmp_is_unportable__use_gnulib_module_strcase_for_portability
 #endif
 
@@ -102,6 +108,7 @@
 extern int strncasecmp (char const *__s1, char const *__s2, size_t __n);
 # endif
 #else
+# undef strncasecmp
 # define strncasecmp strncasecmp_is_unportable__use_gnulib_module_strcase_for_portability
 #endif
 
@@ -111,6 +118,7 @@
 extern char *strchrnul (char const *__s, int __c_in);
 # endif
 #else
+# undef strchrnul
 # define strchrnul strchrnul_is_unportable__use_gnulib_module_strchrnul_for_portability
 #endif
 
@@ -120,6 +128,7 @@
 extern char *strdup (char const *__s);
 # endif
 #else
+# undef strdup
 # define strdup strdup_is_unportable__use_gnulib_module_strdup_for_portability
 #endif
 
@@ -133,6 +142,7 @@
 #  endif
 # endif
 #else
+# undef strndup
 # define strndup strndup_is_unportable__use_gnulib_module_strndup_for_portability
 #endif
 
@@ -144,6 +154,7 @@
 extern size_t strnlen (char const *__string, size_t __maxlen);
 # endif
 #else
+# undef strnlen
 # define strnlen strnlen_is_unportable__use_gnulib_module_strnlen_for_portability
 #endif
 
@@ -153,6 +164,7 @@
 extern char *strpbrk (char const *__s, char const *__accept);
 # endif
 #else
+# undef strpbrk
 # define strpbrk strpbrk_is_unportable__use_gnulib_module_strpbrk_for_portability
 #endif
 
@@ -177,6 +189,7 @@
 extern char *strsep (char **restrict __stringp, char const *restrict __delim);
 # endif
 #else
+# undef strsep
 # define strsep strsep_is_unportable__use_gnulib_module_strsep_for_portability
 #endif
 
@@ -191,6 +204,7 @@
 extern char *strstr (char const *__haystack, char const *__needle);
 # endif
 #else
+# undef strstr
 # define strstr strstr_is_unportable__use_gnulib_module_strstr_for_portability
 #endif
 
@@ -205,6 +219,7 @@
 extern char *strcasestr (const char *haystack, const char *needle);
 # endif
 #else
+# undef strcasestr
 # define strcasestr strcasestr_is_unportable__use_gnulib_module_strcasestr_for_portability
 #endif
 
@@ -236,6 +251,7 @@
 		       char **restrict __lasts);
 # endif
 #else
+# undef strtok_r
 # define strtok_r strtok_r_is_unportable__use_gnulib_module_strtok_r_for_portability
 #endif