]> mj.ucw.cz Git - libucw.git/blobdiff - lib/urlkey.c
define BUCK2OBJ_INITIAL_MAX_LEN
[libucw.git] / lib / urlkey.c
index 82e834013ed796b294d1f32a0e108732b6666c9d..34a6fc81fc1a859ce0b7e11eed976f1ef51005bc 100644 (file)
@@ -45,7 +45,7 @@ struct pxtab_node {
 #define HASH_GIVE_EQ
 #define HASH_GIVE_EXTRA_SIZE
 #define HASH_GIVE_INIT_KEY
-#define HASH_GIVE_ALLOC
+#define HASH_USE_POOL cfpool
 
 static inline uns
 pxtab_hash(HASH_KEY_DECL)
@@ -74,12 +74,6 @@ pxtab_init_key(struct pxtab_node *node, HASH_KEY_DECL)
   node->rhs = NULL;
 }
 
-static inline void *
-pxtab_alloc(uns size)
-{
-  return cfg_malloc(size);
-}
-
 #include "lib/hashtable.h"
 
 static inline byte *
@@ -274,5 +268,26 @@ void
 url_fingerprint(byte *url, struct fingerprint *fp)
 {
   byte buf[URL_KEY_BUF_SIZE];
-  return fingerprint(url_key(url, buf), fp);
+  fingerprint(url_key(url, buf), fp);
+}
+
+#ifdef TEST
+
+int main(int argc, char **argv)
+{
+  cf_read(cfdeffile);
+  url_key_init();
+  for (int i=1; i<argc; i++)
+    {
+      byte buf[URL_KEY_BUF_SIZE];
+      struct fingerprint fp;
+      byte *key = url_key(argv[i], buf);
+      fingerprint(key, &fp);
+      for (int j=0; j<12; j++)
+       printf("%02x", fp.hash[j]);
+      printf(" %s\n", key);
+    }
+  return 0;
 }
+
+#endif