Fixed bug in hash.c
A bug in the delete function in hash.c was preventing the unit test of the new set ID API functions from running properly. In fixing this bug the entire hash table code was refactored to make it look more like the mempool service routines. Also the need to copy the string passed into the table's insert function was eliminated.
This commit is contained in:
@@ -472,7 +472,7 @@ int addnodeID(EN_Network *net, int n, char *id)
|
||||
return (0); /* see EPANET.C */
|
||||
}
|
||||
strncpy(net->Node[n].ID, id, MAXID);
|
||||
ENHashTableInsert(net->NodeHashTable, net->Node[n].ID, n); /* see HASH.C */
|
||||
hashtable_insert(net->NodeHashTable, net->Node[n].ID, n); /* see HASH.C */
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -490,7 +490,7 @@ int addlinkID(EN_Network *net, int n, char *id)
|
||||
return (0); /* see EPANET.C */
|
||||
}
|
||||
strncpy(net->Link[n].ID, id, MAXID);
|
||||
ENHashTableInsert(net->LinkHashTable, net->Link[n].ID, n); /* see HASH.C */
|
||||
hashtable_insert(net->LinkHashTable, net->Link[n].ID, n); /* see HASH.C */
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user