changeset 4643:6ad23581140d

Remove K&R cruft.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 09 Sep 2003 06:48:57 +0000
parents 9f5b3245e524
children 7cd00c652d42
files lib/fnmatch.c lib/fnmatch_.h lib/fnmatch_loop.c m4/fnmatch.m4
diffstat 4 files changed, 12 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/lib/fnmatch.c
+++ b/lib/fnmatch.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, 2001,
-   2002 Free Software Foundation, Inc.
+   2002, 2003 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
@@ -45,23 +45,14 @@
 # define __builtin_expect(expr, expected) (expr)
 #endif
 
-#include <assert.h>
-#include <errno.h>
 #include <fnmatch.h>
-#include <ctype.h>
 
-#if HAVE_STRING_H || defined _LIBC
-# include <string.h>
-#else
-# if HAVE_STRINGS_H
-#  include <strings.h>
-# endif
-#endif
-
-#if defined STDC_HEADERS || defined _LIBC
-# include <stddef.h>
-# include <stdlib.h>
-#endif
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
 
 #define WIDE_CHAR_SUPPORT (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
 
@@ -178,10 +169,6 @@
 /* Avoid depending on library functions or files
    whose names are inconsistent.  */
 
-# if !defined _LIBC && !defined getenv && !HAVE_DECL_GETENV
-extern char *getenv ();
-# endif
-
 # ifndef errno
 extern int errno;
 # endif
@@ -328,10 +315,7 @@
 
 
 int
-fnmatch (pattern, string, flags)
-     const char *pattern;
-     const char *string;
-     int flags;
+fnmatch (const char *pattern, const char *string, int flags)
 {
 # if HANDLE_MULTIBYTE
   if (__builtin_expect (MB_CUR_MAX, 1) != 1)
--- a/lib/fnmatch_.h
+++ b/lib/fnmatch_.h
@@ -22,19 +22,6 @@
 extern "C" {
 # endif
 
-# if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32
-#  if !defined __GLIBC__ || !defined __P
-#   undef	__P
-#   define __P(protos)	protos
-#  endif
-# else /* Not C++ or ANSI C.  */
-#  undef	__P
-#  define __P(protos)	()
-/* We can get away without defining `const' here only because in this file
-   it is used only inside the prototype for `fnmatch', which is elided in
-   non-ANSI C where `const' is problematical.  */
-# endif /* C++ or ANSI C.  */
-
 /* We #undef these before defining them because some losing systems
    (HP-UX A.08.07 for example) define these in <unistd.h>.  */
 # undef	FNM_PATHNAME
@@ -66,8 +53,8 @@
 
 /* Match NAME against the filename pattern PATTERN,
    returning zero if it matches, FNM_NOMATCH if not.  */
-extern int fnmatch __P ((const char *__pattern, const char *__name,
-			 int __flags));
+extern int fnmatch (const char *__pattern, const char *__name,
+		    int __flags);
 
 # ifdef	__cplusplus
 }
--- a/lib/fnmatch_loop.c
+++ b/lib/fnmatch_loop.c
@@ -17,9 +17,6 @@
 
 /* Match STRING against the filename pattern PATTERN, returning zero if
    it matches, nonzero if not.  */
-static int FCT (const CHAR *pattern, const CHAR *string,
-		const CHAR *string_end, int no_leading_period, int flags)
-     internal_function;
 static int EXT (INT opt, const CHAR *pattern, const CHAR *string,
 		const CHAR *string_end, int no_leading_period, int flags)
      internal_function;
@@ -27,12 +24,8 @@
 
 static int
 internal_function
-FCT (pattern, string, string_end, no_leading_period, flags)
-     const CHAR *pattern;
-     const CHAR *string;
-     const CHAR *string_end;
-     int no_leading_period;
-     int flags;
+FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
+     int no_leading_period, int flags)
 {
   register const CHAR *p = pattern, *n = string;
   register UCHAR c;
--- a/m4/fnmatch.m4
+++ b/m4/fnmatch.m4
@@ -77,14 +77,6 @@
 ])# _AC_LIBOBJ_FNMATCH
 
 
-# Additional prerequisites of lib/fnmatch.c, not part of _AC_LIBOBJ_FNMATCH.
-AC_DEFUN([gl_PREREQ_FNMATCH_EXTRA],
-[
-  AC_REQUIRE([AC_HEADER_STDC])
-  AC_CHECK_HEADERS_ONCE(string.h strings.h)
-])
-
-
 AC_DEFUN([gl_FUNC_FNMATCH_POSIX],
 [
   FNMATCH_H=
@@ -92,7 +84,6 @@
                       [rm -f lib/fnmatch.h],
                       [_AC_LIBOBJ_FNMATCH])
   if test $ac_cv_func_fnmatch_posix != yes; then
-    gl_PREREQ_FNMATCH_EXTRA
     dnl We must choose a different name for our function, since on ELF systems
     dnl a broken fnmatch() in libc.so would override our fnmatch() if it is
     dnl compiled into a shared library.
@@ -113,7 +104,6 @@
                       [rm -f lib/fnmatch.h],
                       [_AC_LIBOBJ_FNMATCH])
   if test $ac_cv_func_fnmatch_gnu != yes; then
-    gl_PREREQ_FNMATCH_EXTRA
     dnl We must choose a different name for our function, since on ELF systems
     dnl a broken fnmatch() in libc.so would override our fnmatch() if it is
     dnl compiled into a shared library.