X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Ffnmatch_loop.c;h=d1008c247df2a8553bd9ee5f663c86aa76d7b58d;hb=2354d5ead305b61c925e53bcfb73d47de7c53162;hp=2b5897c44b8b2cfb1d8dc697e86be083a7ef6f53;hpb=3585608d42307ab95969d64555a9c2f92fd90caa;p=gnulib.git diff --git a/lib/fnmatch_loop.c b/lib/fnmatch_loop.c index 2b5897c44..d1008c247 100644 --- a/lib/fnmatch_loop.c +++ b/lib/fnmatch_loop.c @@ -1,5 +1,6 @@ /* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006 - Free Software Foundation, Inc. + Free Software Foundation, Inc. + This file is part of the GNU C Library. 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 @@ -233,8 +234,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, c = FOLD ((UCHAR) *p); ++p; - if (c == fn) - goto matched; + goto normal_bracket; } else if (c == L_('[') && *p == L_(':')) { @@ -288,18 +288,18 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, goto matched; # endif #else - if ((STREQ (str, L_("alnum")) && ISALNUM ((UCHAR) *n)) - || (STREQ (str, L_("alpha")) && ISALPHA ((UCHAR) *n)) - || (STREQ (str, L_("blank")) && ISBLANK ((UCHAR) *n)) - || (STREQ (str, L_("cntrl")) && ISCNTRL ((UCHAR) *n)) - || (STREQ (str, L_("digit")) && ISDIGIT ((UCHAR) *n)) - || (STREQ (str, L_("graph")) && ISGRAPH ((UCHAR) *n)) - || (STREQ (str, L_("lower")) && ISLOWER ((UCHAR) *n)) - || (STREQ (str, L_("print")) && ISPRINT ((UCHAR) *n)) - || (STREQ (str, L_("punct")) && ISPUNCT ((UCHAR) *n)) - || (STREQ (str, L_("space")) && ISSPACE ((UCHAR) *n)) - || (STREQ (str, L_("upper")) && ISUPPER ((UCHAR) *n)) - || (STREQ (str, L_("xdigit")) && ISXDIGIT ((UCHAR) *n))) + if ((STREQ (str, L_("alnum")) && isalnum ((UCHAR) *n)) + || (STREQ (str, L_("alpha")) && isalpha ((UCHAR) *n)) + || (STREQ (str, L_("blank")) && isblank ((UCHAR) *n)) + || (STREQ (str, L_("cntrl")) && iscntrl ((UCHAR) *n)) + || (STREQ (str, L_("digit")) && isdigit ((UCHAR) *n)) + || (STREQ (str, L_("graph")) && isgraph ((UCHAR) *n)) + || (STREQ (str, L_("lower")) && islower ((UCHAR) *n)) + || (STREQ (str, L_("print")) && isprint ((UCHAR) *n)) + || (STREQ (str, L_("punct")) && ispunct ((UCHAR) *n)) + || (STREQ (str, L_("space")) && isspace ((UCHAR) *n)) + || (STREQ (str, L_("upper")) && isupper ((UCHAR) *n)) + || (STREQ (str, L_("xdigit")) && isxdigit ((UCHAR) *n))) goto matched; #endif c = *p++; @@ -494,24 +494,31 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, idx = 0; elem = hash % table_size; - second = hash % (table_size - 2); - while (symb_table[2 * elem] != 0) + if (symb_table[2 * elem] != 0) { - /* First compare the hashing value. */ - if (symb_table[2 * elem] == hash - && c1 == extra[symb_table[2 * elem + 1]] - && memcmp (str, - &extra[symb_table[2 * elem + 1] - + 1], c1) == 0) + second = hash % (table_size - 2) + 1; + + do { - /* Yep, this is the entry. */ - idx = symb_table[2 * elem + 1]; - idx += 1 + extra[idx]; - break; - } + /* First compare the hashing value. */ + if (symb_table[2 * elem] == hash + && (c1 + == extra[symb_table[2 * elem + 1]]) + && memcmp (str, + &extra[symb_table[2 * elem + + 1] + + 1], c1) == 0) + { + /* Yep, this is the entry. */ + idx = symb_table[2 * elem + 1]; + idx += 1 + extra[idx]; + break; + } - /* Next entry. */ - elem += second; + /* Next entry. */ + elem += second; + } + while (symb_table[2 * elem] != 0); } if (symb_table[2 * elem] != 0) @@ -592,6 +599,12 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, if (!is_range && c == fn) goto matched; +#if _LIBC + /* This is needed if we goto normal_bracket; from + outside of is_seqval's scope. */ + is_seqval = false; +#endif + cold = c; c = *p++; } @@ -703,25 +716,30 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, idx = 0; elem = hash % table_size; - second = hash % (table_size - 2); - while (symb_table[2 * elem] != 0) + if (symb_table[2 * elem] != 0) { - /* First compare the hashing value. */ - if (symb_table[2 * elem] == hash - && (c1 - == extra[symb_table[2 * elem + 1]]) - && memcmp (str, - &extra[symb_table[2 * elem + 1] - + 1], c1) == 0) + second = hash % (table_size - 2) + 1; + + do { - /* Yep, this is the entry. */ - idx = symb_table[2 * elem + 1]; - idx += 1 + extra[idx]; - break; + /* First compare the hashing value. */ + if (symb_table[2 * elem] == hash + && (c1 + == extra[symb_table[2 * elem + 1]]) + && memcmp (str, + &extra[symb_table[2 * elem + 1] + + 1], c1) == 0) + { + /* Yep, this is the entry. */ + idx = symb_table[2 * elem + 1]; + idx += 1 + extra[idx]; + break; + } + + /* Next entry. */ + elem += second; } - - /* Next entry. */ - elem += second; + while (symb_table[2 * elem] != 0); } if (symb_table[2 * elem] != 0)