about summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-12-16 18:58:47 +0000
committerUlrich Drepper <drepper@redhat.com>2003-12-16 18:58:47 +0000
commit457beec8d7835d2f021d8c4ef7a51f22932671f8 (patch)
tree75b279dc08c32436014c1e8bd4728ce4354bfbc5 /posix
parentc0d5034ed1517d6e545d141d697abc2f10528c2c (diff)
downloadglibc-457beec8d7835d2f021d8c4ef7a51f22932671f8.tar.gz
glibc-457beec8d7835d2f021d8c4ef7a51f22932671f8.tar.xz
glibc-457beec8d7835d2f021d8c4ef7a51f22932671f8.zip
Update.
2002-12-16  Jakub Jelinek  <jakub@redhat.com>
            Paolo Bonzini  <bonzini@gnu.org>

	* posix/regexec.c (group_nodes_into_DFAstates): Never produce
	dests_ch items that are empty.
Diffstat (limited to 'posix')
-rw-r--r--posix/regexec.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/posix/regexec.c b/posix/regexec.c
index 731b49dd57..0c2f7bf3ff 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -3402,30 +3402,36 @@ group_nodes_into_DFAstates (preg, state, dests_node, dests_ch)
 
 	  if (constraint & NEXT_WORD_CONSTRAINT)
 	    {
+	      unsigned int any_set = 0;
 #ifdef RE_ENABLE_I18N
 	      if (dfa->mb_cur_max > 1)
 		for (j = 0; j < BITSET_UINTS; ++j)
-		  accepts[j] &= (dfa->word_char[j] | ~dfa->sb_char[j]);
+		  any_set |= (accepts[j] &= (dfa->word_char[j] | ~dfa->sb_char[j]));
 	      else
 #endif
 		for (j = 0; j < BITSET_UINTS; ++j)
-		  accepts[j] &= dfa->word_char[j];
+		  any_set |= (accepts[j] &= dfa->word_char[j]);
+	      if (!any_set)
+		continue;
 	    }
 	  if (constraint & NEXT_NOTWORD_CONSTRAINT)
 	    {
+	      unsigned int any_set = 0;
 #ifdef RE_ENABLE_I18N
 	      if (dfa->mb_cur_max > 1)
 		for (j = 0; j < BITSET_UINTS; ++j)
-		  accepts[j] &= ~(dfa->word_char[j] & dfa->sb_char[j]);
+		  any_set |= (accepts[j] &= ~(dfa->word_char[j] & dfa->sb_char[j]));
 	      else
 #endif
 		for (j = 0; j < BITSET_UINTS; ++j)
-		  accepts[j] &= ~dfa->word_char[j];
+		  any_set |= (accepts[j] &= ~dfa->word_char[j]);
+	      if (!any_set)
+		continue;
 	    }
 	}
 
       /* Then divide `accepts' into DFA states, or create a new
-	 state.  */
+	 state.  Above, we make sure that accepts is not empty.  */
       for (j = 0; j < ndests; ++j)
 	{
 	  bitset intersec; /* Intersection sets, see below.  */