Fix -Wundef warnings in fnmatch.c
Commit Message
Fixes -Wundef warnings for MBSTATE_T and HAVE_STRING_H. The
HAVE_STRING_H bit is a merge from the gnulib fnmatch.c and the
MBSTATE_T fix has been posted to gnulib for inclusion.
Tested that the code is unchanged on i386.
Siddhesh
* posix/fnmatch.c: Include string.h unconditionally.
[defined _LIBC || WIDE_CHAR_SUPPORT]: Check if _LIBC is
defined before checking MBSTATE_T.
---
posix/fnmatch.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
Comments
I'd tend toward putting more HAVE_* defines in libc-symbols.h rather than
having gnulib-shared code test _LIBC.
@@ -28,12 +28,7 @@
#include <errno.h>
#include <fnmatch.h>
#include <ctype.h>
-
-#if HAVE_STRING_H || defined _LIBC
-# include <string.h>
-#else
-# include <strings.h>
-#endif
+#include <string.h>
#if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h>
@@ -136,7 +131,7 @@ extern int fnmatch (const char *pattern, const char *string, int flags);
# define ISWCTYPE(WC, WT) iswctype (WC, WT)
# endif
-# if (HAVE_MBSTATE_T && HAVE_MBSRTOWCS) || _LIBC
+# if defined _LIBC || (HAVE_MBSTATE_T && HAVE_MBSRTOWCS)
/* In this case we are implementing the multibyte character handling. */
# define HANDLE_MULTIBYTE 1
# endif