From 23adca690664e60bd61bd4bacbe987863a3b7327 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 9 Sep 2003 06:48:57 +0000 Subject: [PATCH] Remove K&R cruft. --- lib/fnmatch.c | 32 ++++++++------------------------ lib/fnmatch_.h | 17 ++--------------- lib/fnmatch_loop.c | 11 ++--------- m4/fnmatch.m4 | 10 ---------- 4 files changed, 12 insertions(+), 58 deletions(-) diff --git a/lib/fnmatch.c b/lib/fnmatch.c index 73dc0e78ec..fe4e502a51 100644 --- 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 @@ char *alloca (); # define __builtin_expect(expr, expected) (expr) #endif -#include -#include #include -#include - -#if HAVE_STRING_H || defined _LIBC -# include -#else -# if HAVE_STRINGS_H -# include -# endif -#endif -#if defined STDC_HEADERS || defined _LIBC -# include -# include -#endif +#include +#include +#include +#include +#include +#include #define WIDE_CHAR_SUPPORT (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC) @@ -178,10 +169,6 @@ extern int fnmatch (const char *pattern, const char *string, int flags); /* 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 @@ is_char_class (const wchar_t *wcs) 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) diff --git a/lib/fnmatch_.h b/lib/fnmatch_.h index 5d83ac984b..87e661f725 100644 --- 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 . */ # undef FNM_PATHNAME @@ -66,8 +53,8 @@ extern "C" { /* 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 } diff --git a/lib/fnmatch_loop.c b/lib/fnmatch_loop.c index 932d907f1c..a83dd96169 100644 --- 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 const CHAR *END (const CHAR *patternp) internal_function; 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; diff --git a/m4/fnmatch.m4 b/m4/fnmatch.m4 index befb73e277..ba2a88f598 100644 --- a/m4/fnmatch.m4 +++ b/m4/fnmatch.m4 @@ -77,14 +77,6 @@ FNMATCH_H=fnmatch.h ])# _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 @@ AC_DEFUN([gl_FUNC_FNMATCH_POSIX], [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 @@ AC_DEFUN([gl_FUNC_FNMATCH_GNU], [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. -- 2.30.2