summaryrefslogtreecommitdiff
path: root/libhashtable/libhashtable.c
diff options
context:
space:
mode:
Diffstat (limited to 'libhashtable/libhashtable.c')
-rw-r--r--libhashtable/libhashtable.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libhashtable/libhashtable.c b/libhashtable/libhashtable.c
index 38b4ad3..02b981e 100644
--- a/libhashtable/libhashtable.c
+++ b/libhashtable/libhashtable.c
@@ -88,10 +88,11 @@ void ht_freevalues(struct hashtable *ht) {
//this seems too complicated.
int ht_setkey(struct hashtable *ht,char *key,void *value) {
- if(!key) key="(null)";
- unsigned short h=hash(key);
+ unsigned short h;
struct entry *tmp;
int i;
+ if(!key) key="(null)";
+ h=hash(key);
for(i=0;i<ht->kl;i++) {
if(ht->keys[i]==h) break;
}