]> mj.ucw.cz Git - libucw.git/blobdiff - lib/wildmatch.c
Merge with git+ssh://cvs.ucw.cz/projects/sherlock/GIT/sherlock.git#v3.8
[libucw.git] / lib / wildmatch.c
index 9bccae19f158333e53ddb3fb9754982463a7950c..a5eb76ede41e01ac52e84e12a9fb3d3347d0a33f 100644 (file)
@@ -1,18 +1,21 @@
 /*
- *     Fast Pattern Matcher for Short Wildcard Patterns (only `?' and `*' supported)
+ *     UCW Library -- Fast Pattern Matcher for Short Wildcard Patterns (only `?' and `*' supported)
  *
  *     Traditional NFA -> DFA method with on-the-fly DFA construction.
  *
  *     (c) 1999 Martin Mares <mj@ucw.cz>
+ *
+ *     This software may be freely distributed and used according to the terms
+ *     of the GNU Lesser General Public License.
  */
 
-#include <stdio.h>
-#include <string.h>
-
 #include "lib/lib.h"
-#include "lib/pools.h"
+#include "lib/mempool.h"
 #include "lib/wildmatch.h"
 
+#include <stdio.h>
+#include <string.h>
+
 #define MAX_STATES 32          /* Must be <= 32, state 0 is reserved, state 1 is initial */
 #define MAX_CACHED 256         /* Maximum number of cached DFA states */
 #define HASH_SIZE 512          /* Number of entries in DFA hash table (at least MAX_CACHED+MAX_STATES) */
@@ -70,7 +73,7 @@ wp_new_state(struct wildpatt *w, u32 set)
   if (d = w->free_states)
     w->free_states = d->next;
   else
-    d = pool_alloc(w->pool, sizeof(*d));
+    d = mp_alloc(w->pool, sizeof(*d));
   w->hash[h] = d;
   bzero(d, sizeof(*d));
   d->nfa_set = set;
@@ -103,8 +106,7 @@ wp_compile(byte *p, struct mempool *pool)
 
   if (strlen(p) >= MAX_STATES)         /* Too long */
     return NULL;
-  w = pool_alloc(pool, sizeof(*w));
-  bzero(w, sizeof(*w));
+  w = mp_alloc_zero(pool, sizeof(*w));
   w->pool = pool;
   for(i=1; *p; p++)
     {
@@ -209,7 +211,7 @@ int main(int argc, char **argv)
   char buf[1024];
 
   if (argc != 2) return 1;
-  w = wp_compile(argv[1], new_pool(65536));
+  w = wp_compile(argv[1], mp_new(65536));
   if (!w)
     {
       puts("Compile error");