From 3c92d3957f6878131d373d5377e5d391899d025d Mon Sep 17 00:00:00 2001 From: Martin Nilsson <nilsson@fastmail.com> Date: Thu, 14 Jul 2016 22:21:42 +0200 Subject: [PATCH] Reduce hashtable to the actually used bits. --- src/hashtable.c | 18 ++---------------- src/hashtable.h | 4 ---- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/hashtable.c b/src/hashtable.c index 443283b42e..293a05a5e0 100644 --- a/src/hashtable.c +++ b/src/hashtable.c @@ -57,7 +57,7 @@ static void rehash_list_backwards(struct hash_table *h, /* * create a new, empty hashable */ -struct hash_table *create_hash_table(void) +static struct hash_table *create_hash_table(void) { struct hash_table *new; new=calloc(1, sizeof(struct hash_table)+ @@ -70,7 +70,7 @@ struct hash_table *create_hash_table(void) /* * rehash - ugh */ -struct hash_table *hash_rehash(struct hash_table *h,int size) +static struct hash_table *hash_rehash(struct hash_table *h,int size) { struct hash_table *new; int e; @@ -139,20 +139,6 @@ struct hash_table *hash_unlink(struct hash_table *h, struct hash_entry *s) return h; } -void map_hashtable(struct hash_table *h, void (*fun)(struct hash_entry *)) -{ - INT32 e; - struct hash_entry *i, *n; - for(e=0;e<=h->mask;e++) - { - for(i=h->htable[e];i;i=n) - { - n=i->next; - fun(i); - } - } -} - void free_hashtable(struct hash_table *h, void (*free_entry)(struct hash_entry *)) { diff --git a/src/hashtable.h b/src/hashtable.h index ff9caa9036..70fa10be4b 100644 --- a/src/hashtable.h +++ b/src/hashtable.h @@ -36,18 +36,14 @@ struct hash_table * NB: hash_insert is known to clash with mariadb-connector-c 2.2. */ #define hash_lookup pike_hash_lookup -#define hash_rehash pike_hash_rehash #define hash_insert pike_hash_insert #define hash_unlink pike_hash_unlink /* Prototypes begin here */ struct hash_entry *hash_lookup(const struct hash_table *h, const struct pike_string *s); -struct hash_table *create_hash_table(void); -struct hash_table *hash_rehash(struct hash_table *h,int size); struct hash_table *hash_insert(struct hash_table *h, struct hash_entry *s); struct hash_table *hash_unlink(struct hash_table *h, struct hash_entry *s); -void map_hashtable(struct hash_table *h, void (*fun)(struct hash_entry *)); void free_hashtable(struct hash_table *h, void (*free_entry)(struct hash_entry *)); /* Prototypes end here */ -- GitLab