From 360053ccc0b524d1a902a6e0a4f91fb4889311f9 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 3 Jan 2013 17:01:09 -0800 Subject: [PATCH] hashtable: style --- hashtable.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/hashtable.h b/hashtable.h index 016d492..a15265b 100644 --- a/hashtable.h +++ b/hashtable.h @@ -109,7 +109,7 @@ template> _Shift; do { - index = index & capacitymask; + index &= capacitymask; search = &table[index]; if (search->key == key) { search->val = val; @@ -129,11 +129,10 @@ template> _Shift; do { - index = index&capacitymask; + index &= capacitymask; search = &table[index]; - if (search->key == key) { + if (search->key == key) return search->val; - } index++; } while (search->key); return (_Val) 0; @@ -145,11 +144,10 @@ template> _Shift; do { - index = index & capacitymask; + index &= capacitymask; search = &table[index]; - if (search->key == key) { + if (search->key == key) return true; - } index++; } while (search->key); return false; @@ -162,8 +160,8 @@ template *) _calloc(newsize, sizeof(struct hashlistnode<_Key, _Val>))) == NULL) { - model_print("Calloc error %s %d\n", __FILE__, __LINE__); - exit(-1); + model_print("calloc error %s %d\n", __FILE__, __LINE__); + exit(EXIT_FAILURE); } table = newtable; //Update the global hashtable upon resize() @@ -181,7 +179,7 @@ template> _Shift; do { - index = index & capacitymask; + index &= capacitymask; search = &table[index]; index++; } while (search->key); -- 2.34.1