diff options
| -rw-r--r-- | include/hash.h | 7 | ||||
| -rw-r--r-- | src/cache.c | 8 | ||||
| -rw-r--r-- | src/filter.c | 4 | ||||
| -rw-r--r-- | src/hash.c | 3 | 
4 files changed, 13 insertions, 9 deletions
diff --git a/include/hash.h b/include/hash.h index d260f65..2fb0a27 100644 --- a/include/hash.h +++ b/include/hash.h @@ -17,8 +17,8 @@ struct hashtable {  	uint32_t initval;  	uint32_t datasize; -	uint32_t	(*hash)(const void *data, struct hashtable *table); -	int		(*compare)(const void *data1, const void *data2); +	uint32_t (*hash)(const void *data, const struct hashtable *table); +	int	 (*compare)(const void *data1, const void *data2);  	struct slist_head 	members[0];  }; @@ -33,7 +33,8 @@ void hashtable_destroy_node(struct hashtable_node *h);  struct hashtable *  hashtable_create(int hashsize, int limit, int datasize, -		 uint32_t (*hash)(const void *data, struct hashtable *table), +		 uint32_t (*hash)(const void *data, +		 		  const struct hashtable *table),  		 int (*compare)(const void *data1, const void *data2));  void hashtable_destroy(struct hashtable *h); diff --git a/src/cache.c b/src/cache.c index 525832b..553dddf 100644 --- a/src/cache.c +++ b/src/cache.c @@ -28,7 +28,8 @@  #include <stdlib.h>  #include <string.h> -static uint32_t __hash4(const struct nf_conntrack *ct, struct hashtable *table) +static uint32_t +__hash4(const struct nf_conntrack *ct, const struct hashtable *table)  {  	uint32_t a[4] = {  		[0]	= nfct_get_attr_u32(ct, ATTR_IPV4_SRC), @@ -49,7 +50,8 @@ static uint32_t __hash4(const struct nf_conntrack *ct, struct hashtable *table)  	return ((uint64_t)jhash2(a, 4, 0) * table->hashsize) >> 32;  } -static uint32_t __hash6(const struct nf_conntrack *ct, struct hashtable *table) +static uint32_t +__hash6(const struct nf_conntrack *ct, const struct hashtable *table)  {  	uint32_t a[10]; @@ -63,7 +65,7 @@ static uint32_t __hash6(const struct nf_conntrack *ct, struct hashtable *table)  	return ((uint64_t)jhash2(a, 10, 0) * table->hashsize) >> 32;  } -static uint32_t hash(const void *data, struct hashtable *table) +static uint32_t hash(const void *data, const struct hashtable *table)  {  	int ret = 0;  	const struct us_conntrack *u = data; diff --git a/src/filter.c b/src/filter.c index 218ba0c..a3432a2 100644 --- a/src/filter.c +++ b/src/filter.c @@ -44,14 +44,14 @@ struct ct_filter {  #define FILTER_POOL_SIZE 128  #define FILTER_POOL_LIMIT INT_MAX -static uint32_t hash(const void *data, struct hashtable *table) +static uint32_t hash(const void *data, const struct hashtable *table)  {  	const uint32_t *f = data;  	return jhash_1word(*f, 0) % table->hashsize;  } -static uint32_t hash6(const void *data, struct hashtable *table) +static uint32_t hash6(const void *data, const struct hashtable *table)  {  	return jhash2(data, 4, 0) % table->hashsize;  } @@ -46,7 +46,8 @@ void hashtable_destroy_node(struct hashtable_node *h)  struct hashtable *  hashtable_create(int hashsize, int limit, int datasize, -		 uint32_t (*hash)(const void *data, struct hashtable *table), +		 uint32_t (*hash)(const void *data, +		 		  const struct hashtable *table),  		 int (*compare)(const void *data1, const void *data2))  {  	int i;  | 
