Browse code

port hashmatch to non-mpool

aCaB authored on 2011/01/15 07:25:27
Showing 4 changed files
... ...
@@ -369,6 +369,10 @@ static int cli_hashtab_grow(struct cli_hashtable *s)
369 369
 	return CL_SUCCESS;
370 370
 }
371 371
 
372
+#ifndef USE_MPOOL
373
+#define cli_htu32_grow(A, B) cli_htu32_grow(A)
374
+#endif
375
+
372 376
 static int cli_htu32_grow(struct cli_htu32 *s, mpool_t *mempool)
373 377
 {
374 378
 	const size_t new_capacity = nearest_power(s->capacity + 1);
... ...
@@ -104,6 +104,11 @@ struct cli_htu32 {
104 104
     STRUCT_PROFILE
105 105
 };
106 106
 
107
+#ifndef USE_MPOOL
108
+#define cli_htu32_init(A, B, C) cli_htu32_init(A, B)
109
+#define cli_htu32_insert(A, B, C) cli_htu32_insert(A, B)
110
+#define cli_htu32_free(A, B) cli_htu32_free(A)
111
+#endif
107 112
 int cli_htu32_init(struct cli_htu32 *s, size_t capacity, mpool_t *mempool);
108 113
 int cli_htu32_insert(struct cli_htu32 *s, const struct cli_htu32_element *item, mpool_t *mempool);
109 114
 const struct cli_htu32_element *cli_htu32_find(const struct cli_htu32 *s, uint32_t key);
... ...
@@ -48,7 +48,6 @@ struct cli_hash_patt {
48 48
     struct cli_htu32 sizehashes[CLI_HASH_AVAIL_TYPES];
49 49
 };
50 50
 
51
-
52 51
 int hm_addhash(struct cli_matcher *root, const char *hash, uint32_t size, const char *virusname);
53 52
 void hm_flush(struct cli_matcher *root);
54 53
 int cli_hm_scan(const unsigned char *digest, uint32_t size, const char **virname, const struct cli_matcher *root, enum CLI_HASH_TYPE type);
... ...
@@ -1954,7 +1954,9 @@ static int cli_loadhash(FILE *fs, struct cl_engine *engine, unsigned int *signo,
1954 1954
 		ret = CL_EMEM;
1955 1955
 		break;
1956 1956
 	    }
1957
+#ifdef USE_MPOOL
1957 1958
 	    db->mempool = engine->mempool;
1959
+#endif
1958 1960
 	    if(mode == MD5_HDB)
1959 1961
 		engine->hm_hdb = db;
1960 1962
 	    else if(mode == MD5_MDB)