/[grep]/grep/src/kwset.c
ViewVC logotype

Diff of /grep/src/kwset.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by charles_levert, Mon Jul 4 04:29:10 2005 UTC revision 1.8 by charles_levert, Mon Jul 4 04:39:03 2005 UTC
# Line 388  kwsprep (kwset_t kws) Line 388  kwsprep (kwset_t kws)
388    /* Initial values for the delta table; will be changed later.  The    /* Initial values for the delta table; will be changed later.  The
389       delta entry for a given character is the smallest depth of any       delta entry for a given character is the smallest depth of any
390       node at which an outgoing edge is labeled by that character. */       node at which an outgoing edge is labeled by that character. */
391    if (kwset->mind < 256)    memset(delta, kwset->mind < UCHAR_MAX ? kwset->mind : UCHAR_MAX, NCHAR);
     for (i = 0; i < NCHAR; ++i)  
       delta[i] = kwset->mind;  
   else  
     for (i = 0; i < NCHAR; ++i)  
       delta[i] = 255;  
392    
393    /* Check if we can use the simple boyer-moore algorithm, instead    /* Check if we can use the simple boyer-moore algorithm, instead
394       of the hairy commentz-walter algorithm. */       of the hairy commentz-walter algorithm. */
# Line 473  kwsprep (kwset_t kws) Line 468  kwsprep (kwset_t kws)
468          for (i = 0; i < NCHAR; ++i)          for (i = 0; i < NCHAR; ++i)
469            kwset->next[i] = next[U(trans[i])];            kwset->next[i] = next[U(trans[i])];
470        else        else
471          for (i = 0; i < NCHAR; ++i)          memcpy(kwset->next, next, NCHAR * sizeof(struct trie *));
           kwset->next[i] = next[i];  
472      }      }
473    
474    /* Fix things up for any translation table. */    /* Fix things up for any translation table. */
# Line 482  kwsprep (kwset_t kws) Line 476  kwsprep (kwset_t kws)
476      for (i = 0; i < NCHAR; ++i)      for (i = 0; i < NCHAR; ++i)
477        kwset->delta[i] = delta[U(trans[i])];        kwset->delta[i] = delta[U(trans[i])];
478    else    else
479      for (i = 0; i < NCHAR; ++i)      memcpy(kwset->delta, delta, NCHAR);
       kwset->delta[i] = delta[i];  
480    
481    return NULL;    return NULL;
482  }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26