changeset 7929:dd05f4bdf2f2

Import the following changes from libc. 2005-10-14 Ulrich Drepper <drepper@redhat.com> * lib/fnmatch_loop.c: Adjust for changed secondary hash function. 2004-12-01 Jakub Jelinek <jakub@redhat.com> * lib/fnmatch_loop.c (internal_fnmatch): Clear is_seqval after normal_bracket label. 2004-09-01 Jakub Jelinek <jakub@redhat.com> [BZ #361] * lib/fnmatch_loop.c (FCT): For backslash between brackets, branch to normal_bracket after fetching the next character.
author Paul Eggert <eggert@cs.ucla.edu>
date Wed, 24 Jan 2007 00:15:58 +0000
parents e00d2d470e73
children 8929067c3772
files ChangeLog lib/fnmatch_loop.c
diffstat 2 files changed, 68 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2007-01-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+	Import the following changes from libc.
+
+	2005-10-14  Ulrich Drepper  <drepper@redhat.com>
+
+	* lib/fnmatch_loop.c: Adjust for changed secondary hash function.
+
+	2004-12-01  Jakub Jelinek  <jakub@redhat.com>
+
+	* lib/fnmatch_loop.c (internal_fnmatch): Clear is_seqval after
+	normal_bracket label.
+
+	2004-09-01  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #361]
+	* lib/fnmatch_loop.c (FCT): For backslash between brackets, branch
+	to normal_bracket after fetching the next character.
+
 2007-01-22  Bruno Haible  <bruno@clisp.org>
 
 	* lib/striconveh.h (mem_cd_iconveh, mem_iconveh): Add 'offsets'
--- 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 @@
 		    c = FOLD ((UCHAR) *p);
 		    ++p;
 
-		    if (c == fn)
-		      goto matched;
+		    goto normal_bracket;
 		  }
 		else if (c == L_('[') && *p == L_(':'))
 		  {
@@ -494,24 +494,31 @@
 
 			    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,9 @@
 			if (!is_range && c == fn)
 			  goto matched;
 
+			/* This is needed if we goto normal_bracket; from
+			   outside of is_seqval's scope.  */
+			is_seqval = false;
 			cold = c;
 			c = *p++;
 		      }
@@ -703,25 +713,30 @@
 
 				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)