From: Brian Norris Date: Fri, 4 Jan 2013 01:01:09 +0000 (-0800) Subject: hashtable: style X-Git-Tag: oopsla2013~374 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=360053ccc0b524d1a902a6e0a4f91fb4889311f9;p=model-checker.git hashtable: style --- 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);