]> mj.ucw.cz Git - libucw.git/blobdiff - lib/kmp.c
CONFIG_INCREMENTAL doesn't belong to the free version
[libucw.git] / lib / kmp.c
index 15aff3d1e98e80e8f776c7fa44518d2baad90317..c2e2dd10f8437a11c9ea8d7ac2d067277813fa5c 100644 (file)
--- a/lib/kmp.c
+++ b/lib/kmp.c
@@ -1,22 +1,20 @@
 /*
- *     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)
@@ -34,7 +32,7 @@ kmp_new(struct mempool *mp, int words_len, uns modify_flags)
        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;