void Zoltan_Reftree_Hash_Remove (ZZ *zz, ZOLTAN_REFTREE *reftree_node, struct Zoltan_Reftree_hash_node **hashtab, int n) { int i; struct Zoltan_Reftree_hash_node *ptr, *prev, *next; i = Zoltan_Hash(reftree_node->global_id, zz->Num_GID, (unsigned int)n); ptr = hashtab[i]; prev = NULL; while (ptr != NULL) { if (ZOLTAN_EQ_GID(zz, ptr->gid, reftree_node->global_id)) { next = ptr->next; ZOLTAN_FREE(&(ptr->gid)); ZOLTAN_FREE(&ptr); if (prev == NULL) { hashtab[i] = next; } else { prev->next = next; } ptr = NULL; } else { prev = ptr; ptr = ptr->next; } } }
int Zoltan_Reftree_inthash_lookup (ZZ *zz, struct Zoltan_Reftree_inthash_node **hashtab, ZOLTAN_ID_PTR key, int n) { int i; struct Zoltan_Reftree_inthash_node *ptr; i = Zoltan_Hash(key, zz->Num_GID, (unsigned int)n); for (ptr=hashtab[i]; ptr != NULL; ptr = ptr->next){ if (ZOLTAN_EQ_GID(zz, ptr->gid, key)) return (ptr->lid); } /* Key not in hash table */ return -1; }
static int search_hash_table(ZZ *zz, ZOLTAN_ID_PTR gid, struct Hash_Node **ht, int tableSize) { int j, found; struct Hash_Node *hn; found = -1; j = Zoltan_Hash(gid, zz->Num_GID, tableSize); hn = ht[j]; while (hn){ if (ZOLTAN_EQ_GID(zz, gid, hn->gid)){ found = hn->gno; break; } hn = hn->next; } return found; }