|
48 | 48 | * if (!strcmp("add", action)) { |
49 | 49 | * struct long2string *e; |
50 | 50 | * FLEX_ALLOC_STR(e, value, value); |
51 | | - * hashmap_entry_init(e, memhash(&key, sizeof(long))); |
| 51 | + * hashmap_entry_init(&e->ent, memhash(&key, sizeof(long))); |
52 | 52 | * e->key = key; |
53 | 53 | * hashmap_add(&map, e); |
54 | 54 | * } |
55 | 55 | * |
56 | 56 | * if (!strcmp("print_all_by_key", action)) { |
57 | 57 | * struct long2string k, *e; |
58 | | - * hashmap_entry_init(&k, memhash(&key, sizeof(long))); |
| 58 | + * hashmap_entry_init(&k->ent, memhash(&key, sizeof(long))); |
59 | 59 | * k.key = key; |
60 | 60 | * |
61 | 61 | * flags &= ~COMPARE_VALUE; |
|
70 | 70 | * if (!strcmp("has_exact_match", action)) { |
71 | 71 | * struct long2string *e; |
72 | 72 | * FLEX_ALLOC_STR(e, value, value); |
73 | | - * hashmap_entry_init(e, memhash(&key, sizeof(long))); |
| 73 | + * hashmap_entry_init(&e->ent, memhash(&key, sizeof(long))); |
74 | 74 | * e->key = key; |
75 | 75 | * |
76 | 76 | * flags |= COMPARE_VALUE; |
|
80 | 80 | * |
81 | 81 | * if (!strcmp("has_exact_match_no_heap_alloc", action)) { |
82 | 82 | * struct long2string k; |
83 | | - * hashmap_entry_init(&k, memhash(&key, sizeof(long))); |
| 83 | + * hashmap_entry_init(&k->ent, memhash(&key, sizeof(long))); |
84 | 84 | * k.key = key; |
85 | 85 | * |
86 | 86 | * flags |= COMPARE_VALUE; |
@@ -244,9 +244,9 @@ void hashmap_free(struct hashmap *map, int free_entries); |
244 | 244 | * your structure was allocated with xmalloc(), you can just free(3) it, |
245 | 245 | * and if it is on stack, you can just let it go out of scope). |
246 | 246 | */ |
247 | | -static inline void hashmap_entry_init(void *entry, unsigned int hash) |
| 247 | +static inline void hashmap_entry_init(struct hashmap_entry *e, |
| 248 | + unsigned int hash) |
248 | 249 | { |
249 | | - struct hashmap_entry *e = entry; |
250 | 250 | e->hash = hash; |
251 | 251 | e->next = NULL; |
252 | 252 | } |
|
0 commit comments