/*
- * Knuth-Morris-Pratt's search automat for N given strings
- * (taken from ad2 super-server and pruned :-)
- *
+ * Knuth-Morris-Pratt's Substring Search for N given strings
+ *
* (c) 1999--2005, Robert Spalek <robert@ucw.cz>
*/
#include "lib/lib.h"
+#include "lib/bitops.h"
#include "lib/mempool.h"
#include "lib/lists.h"
-#include "sherlock/tagged-text.h"
#include "lib/unicode.h"
-#define KMP_TRANSLATE(new_c, c, flags) NO_TRANSLATE(new_c, c, flags)
+#define KMP_GET_CHAR KMP_GET_RAW
#include "lib/kmp.h"
#include <stdlib.h>
#include <stdio.h>
-#include <string.h>
#include <alloca.h>
#define TRACE(level, mask...) if (0) fprintf(stderr, mask)
kmp->g.sons = mp_alloc_zero(mp, size * sizeof(struct list));
init_list(kmp->g.sons + 0);
if (words_len > 1)
- size = words_len * fls(words_len);
+ size = words_len * bit_fls(words_len);
else
size = 1;
kmp->g.hash_size = size;