Add an explicit hash_delete() function.
[oweals/tinc.git] / src / hash.c
index 8fb9ca69fd7f5e20b403a74052f733681b605c05..91fc3d6754341c0d738b802ce925cb7522268991 100644 (file)
@@ -91,6 +91,13 @@ void *hash_search_or_insert(hash_t *hash, const void *key, const void *value) {
        return NULL;
 }
 
+/* Deleting */
+
+void hash_delete(hash_t *hash, const void *key) {
+       uint32_t i = modulo(hash_function(key, hash->size), hash->n);
+       hash->values[i] = NULL;
+}
+
 /* Utility functions */
 
 void hash_clear(hash_t *hash) {