aboutsummaryrefslogtreecommitdiffstats
path: root/hashmap.h
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-10-06 23:30:29 +0000
committerJunio C Hamano <gitster@pobox.com>2019-10-07 10:20:10 +0900
commitb94e5c1df674eb4ec8fdeaaae1ad8df552cb5d70 (patch)
tree81566486743a5dafb2dddaf09de597529223f315 /hashmap.h
parentf6eb6bdcf2719defc3d38e0e2712fa3e18d29e91 (diff)
downloadgit-b94e5c1df674eb4ec8fdeaaae1ad8df552cb5d70.tar.gz
hashmap_add takes "struct hashmap_entry *"
This is less error-prone than "void *" as the compiler now detects invalid types being passed. Signed-off-by: Eric Wong <e@80x24.org> Reviewed-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'hashmap.h')
-rw-r--r--hashmap.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/hashmap.h b/hashmap.h
index 93fb9599ca..47ee5c00d7 100644
--- a/hashmap.h
+++ b/hashmap.h
@@ -50,7 +50,7 @@
* FLEX_ALLOC_STR(e, value, value);
* hashmap_entry_init(&e->ent, memhash(&key, sizeof(long)));
* e->key = key;
- * hashmap_add(&map, e);
+ * hashmap_add(&map, &e->ent);
* }
*
* if (!strcmp("print_all_by_key", action)) {
@@ -328,7 +328,7 @@ void *hashmap_get_next(const struct hashmap *map,
* `map` is the hashmap structure.
* `entry` is the entry to add.
*/
-void hashmap_add(struct hashmap *map, void *entry);
+void hashmap_add(struct hashmap *map, struct hashmap_entry *entry);
/*
* Adds or replaces a hashmap entry. If the hashmap contains duplicate