grep-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to grep/src/kwset.c


From: Charles Levert
Subject: Changes to grep/src/kwset.c
Date: Mon, 04 Jul 2005 00:39:04 -0400

Index: grep/src/kwset.c
diff -u grep/src/kwset.c:1.7 grep/src/kwset.c:1.8
--- grep/src/kwset.c:1.7        Mon Jul  4 04:29:10 2005
+++ grep/src/kwset.c    Mon Jul  4 04:39:03 2005
@@ -388,12 +388,7 @@
   /* Initial values for the delta table; will be changed later.  The
      delta entry for a given character is the smallest depth of any
      node at which an outgoing edge is labeled by that character. */
-  if (kwset->mind < 256)
-    for (i = 0; i < NCHAR; ++i)
-      delta[i] = kwset->mind;
-  else
-    for (i = 0; i < NCHAR; ++i)
-      delta[i] = 255;
+  memset(delta, kwset->mind < UCHAR_MAX ? kwset->mind : UCHAR_MAX, NCHAR);
 
   /* Check if we can use the simple boyer-moore algorithm, instead
      of the hairy commentz-walter algorithm. */
@@ -473,8 +468,7 @@
        for (i = 0; i < NCHAR; ++i)
          kwset->next[i] = next[U(trans[i])];
       else
-       for (i = 0; i < NCHAR; ++i)
-         kwset->next[i] = next[i];
+       memcpy(kwset->next, next, NCHAR * sizeof(struct trie *));
     }
 
   /* Fix things up for any translation table. */
@@ -482,8 +476,7 @@
     for (i = 0; i < NCHAR; ++i)
       kwset->delta[i] = delta[U(trans[i])];
   else
-    for (i = 0; i < NCHAR; ++i)
-      kwset->delta[i] = delta[i];
+    memcpy(kwset->delta, delta, NCHAR);
 
   return NULL;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]