From 7875a15929f1d5c59e4f5c1fd1f43b70599bc4b9 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 15 Sep 2005 16:25:48 +0000 Subject: [PATCH] Fix redefinition problem: strstr may be defined as a macro in string.h. --- lib/ChangeLog | 4 ++++ lib/strstr.h | 10 ++++++++++ m4/ChangeLog | 4 ++++ m4/strstr.m4 | 3 +-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 20d8109a90..493218c521 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2005-09-15 Derek Price + + * strstr.h: Include string.h. Define strstr as a macro here. + 2005-09-13 Derek Price * canon-host.c (canon_host_r): Set *cherror on memory allocation diff --git a/lib/strstr.h b/lib/strstr.h index ca9a82a965..a28b1401ea 100644 --- a/lib/strstr.h +++ b/lib/strstr.h @@ -15,10 +15,20 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Include string.h: on glibc systems, it contains a macro definition of + strstr() that would collide with our definition if included afterwards. */ +#include + #ifdef __cplusplus extern "C" { #endif +/* No known system has a strstr() function that works correctly in + multibyte locales. Therefore we use our version always. */ +#undef strstr +#define strstr rpl_strstr + /* Find the first occurrence of NEEDLE in HAYSTACK. */ extern char *strstr (const char *haystack, const char *needle); diff --git a/m4/ChangeLog b/m4/ChangeLog index 411b56c41c..17ffb8aef8 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,7 @@ +2005-09-15 Derek Price + + * strstr.m4 (gl_FUNC_STRSTR): Don't define strstr here. + 2005-09-12 Derek Price Make canon-host require getaddrinfo. diff --git a/m4/strstr.m4 b/m4/strstr.m4 index 2856ce75c7..aea809ebd1 100644 --- a/m4/strstr.m4 +++ b/m4/strstr.m4 @@ -1,4 +1,4 @@ -# strstr.m4 serial 3 +# strstr.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, @@ -9,7 +9,6 @@ AC_DEFUN([gl_FUNC_STRSTR], dnl No known system has a strstr() function that works correctly in dnl multibyte locales. Therefore we use our version always. AC_LIBOBJ(strstr) - AC_DEFINE(strstr, rpl_strstr, [Define to rpl_strstr always.]) gl_PREREQ_STRSTR ]) -- 2.30.2