Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void _setTableSize(struct hashMap *ht, int newTableSize)
- {
- struct hashLink **oldTable = ht->table;
- int oldSize = ht->tableSize;
- _initMap(ht, 2 * oldSize);
- /* iterate through the old table, and place all linked lists into the new table */
- for (int n = 0; n < oldSize; n++) {
- struct hashLink *current = oldTable[n];
- while (current) { // While current is not NULL
- struct hashLink *temp = current->next;
- insertMap(ht, current->key, current->value);
- free(current); // Free the memory being held by the link
- current = temp;
- }
- }
- /* Free the memory being held by the old table */
- free(oldTable);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement