shithub: rgbds

Download patch

ref: d2f6def2eb6da8b16b90f0bba95ace24b45d255b
parent: 1ffd7cb5bbf1920ac6b51f39e7e2df59b7a787a7
author: Rangi <[email protected]>
date: Fri Apr 16 08:36:45 EDT 2021

Remove unused function `hash_ReplaceElement`

--- a/include/hashmap.h
+++ b/include/hashmap.h
@@ -34,16 +34,6 @@
 void **hash_AddElement(HashMap map, char const *key, void *element);
 
 /**
- * Replaces an element with an already-present key in a hashmap.
- * @warning Inserting a NULL will make `hash_GetElement`'s return ambiguous!
- * @param map The HashMap to replace the element in
- * @param key The key with which the element will be stored and retrieved
- * @param element The element to replace
- * @return True if the element was found and replaced
- */
-bool hash_ReplaceElement(HashMap const map, char const *key, void *element);
-
-/**
  * Removes an element from a hashmap.
  * @param map The HashMap to remove the element from
  * @param key The key to search the element with
--- a/src/hashmap.c
+++ b/src/hashmap.c
@@ -64,18 +64,6 @@
 	return &newEntry->content;
 }
 
-bool hash_ReplaceElement(HashMap const map, char const *key, void *element)
-{
-	void **node = hash_GetNode(map, key);
-
-	if (node) {
-		*node = element;
-		return true;
-	} else {
-		return false;
-	}
-}
-
 bool hash_RemoveElement(HashMap map, char const *key)
 {
 	HashType hashedKey = hash(key);