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. */ |
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. */ |
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 |
} |
} |