X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=Robust%2Fsrc%2FRuntime%2FDSTM%2Finterface%2Fclookup.c;h=e7bb74e84485554313c2564fb852e5f0eed94100;hb=5c4a12ad1998ff9599ee52f98870dcb394768e9e;hp=45ac76c6cbbaa7e2398150010eb27de72e8b72ae;hpb=e05aca6b246658926ad51a6168d96cd701cd5891;p=IRC.git diff --git a/Robust/src/Runtime/DSTM/interface/clookup.c b/Robust/src/Runtime/DSTM/interface/clookup.c index 45ac76c6..e7bb74e8 100644 --- a/Robust/src/Runtime/DSTM/interface/clookup.c +++ b/Robust/src/Runtime/DSTM/interface/clookup.c @@ -66,12 +66,10 @@ unsigned int chashInsert(chashtable_t *table, unsigned int key, void *val) { // Search for an address for a given oid void *chashSearch(chashtable_t *table, unsigned int key) { - int index; - chashlistnode_t *ptr, *node; + int index = chashFunction(table, key); + chashlistnode_t *ptr =table -> table; + chashlistnode_t *node = &ptr[index]; - ptr = table->table; - index = chashFunction(table, key); - node = &ptr[index]; while(node != NULL) { if(node->key == key) { return node->val; @@ -177,12 +175,12 @@ unsigned int chashResize(chashtable_t *table, unsigned int newsize) { } //Delete the entire hash table -void chashDelete(chashtable_t *table) { +void chashDelete(chashtable_t *ctable) { int i, isFirst; chashlistnode_t *ptr, *curr, *next; - ptr = table->table; + ptr = ctable->table; - for(i=0 ; isize ; i++) { + for(i=0 ; isize ; i++) { curr = &ptr[i]; isFirst = 1 ; while(curr != NULL) { @@ -196,6 +194,7 @@ void chashDelete(chashtable_t *table) { } free(ptr); - free(table); - table = NULL; + ptr = NULL; + free(ctable); + ctable = NULL; }