X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Ffnmatch_loop.c;h=a83dd96169e6c627ab1144d18d4a6108df4a46c6;hb=df308e3fc0bbea8e50977ab1e86e4ddf124606d8;hp=e7b0a91fea31e4344b4f466fc680d11e168bcdaa;hpb=e6d58e55d6ac520a2587210d1856d90455fd860e;p=gnulib.git diff --git a/lib/fnmatch_loop.c b/lib/fnmatch_loop.c index e7b0a91fe..a83dd9616 100644 --- a/lib/fnmatch_loop.c +++ b/lib/fnmatch_loop.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 @@ -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; @@ -248,7 +241,7 @@ FCT (pattern, string, string_end, no_leading_period, flags) /* Leave room for the null. */ CHAR str[CHAR_CLASS_MAX_LENGTH + 1]; size_t c1 = 0; -#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) +#if defined _LIBC || WIDE_CHAR_SUPPORT wctype_t wt; #endif const CHAR *startp = p; @@ -278,7 +271,7 @@ FCT (pattern, string, string_end, no_leading_period, flags) } str[c1] = L('\0'); -#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) +#if defined _LIBC || WIDE_CHAR_SUPPORT wt = IS_CHAR_CLASS (str); if (wt == 0) /* Invalid character class name. */ @@ -1051,13 +1044,14 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, /* This means we found the end of the pattern. */ #define NEW_PATTERN \ struct patternlist *newp; \ + size_t plen; \ \ - if (opt == L('?') || opt == L('@')) \ - newp = alloca (offsetof (struct patternlist, str) \ - + (pattern_len * sizeof (CHAR))); \ - else \ - newp = alloca (offsetof (struct patternlist, str) \ - + ((p - startp + 1) * sizeof (CHAR))); \ + plen = (opt == L('?') || opt == L('@') \ + ? pattern_len \ + : p - startp + 1); \ + newp = (struct patternlist *) \ + alloca (offsetof (struct patternlist, str) \ + + (plen * sizeof (CHAR))); \ *((CHAR *) MEMPCPY (newp->str, startp, p - startp)) = L('\0'); \ newp->next = NULL; \ *lastp = newp; \