hash_AddElement: return the new node

This commit is contained in:
Jakub Kądziołka authored and Eldred Habert committed 2021-04-16 16:00:26 +02:00
1 parent 5334fc334e
commit 8885f7bcf6
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -46,7 +46,7 @@ static HashType hash(char const *str)
return hash;
}
bool hash_AddElement(HashMap map, char const *key, void *element)
void **hash_AddElement(HashMap map, char const *key, void *element)
{
HashType hashedKey = hash(key);
HalfHashType index = hashedKey;
@@ -61,7 +61,7 @@ bool hash_AddElement(HashMap map, char const *key, void *element)
newEntry->next = map[index];
map[index] = newEntry;
return newEntry->next != NULL;
return &newEntry->content;
}
bool hash_ReplaceElement(HashMap const map, char const *key, void *element)