diff options
| author | Eric Wong <e@80x24.org> | 2019-10-06 23:30:27 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2019-10-07 10:20:09 +0900 |
| commit | d22245a2e360d2e708ca37169be8eb5a5899b98d (patch) | |
| tree | f1bde8f5da6ea424fa1f9538d6debd4b5fd6b5f4 /t/helper/test-hashmap.c | |
| parent | d0a48a0a1d0df49af2e5fd6a80b0d84776c285aa (diff) | |
| download | git-d22245a2e360d2e708ca37169be8eb5a5899b98d.tar.gz | |
hashmap_entry_init takes "struct hashmap_entry *"
C compilers do type checking to make life easier for us. So
rely on that and update all hashmap_entry_init callers to take
"struct hashmap_entry *" to avoid future bugs while improving
safety and readability.
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 't/helper/test-hashmap.c')
| -rw-r--r-- | t/helper/test-hashmap.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/t/helper/test-hashmap.c b/t/helper/test-hashmap.c index aaf17b0ddf..0c9fd7c996 100644 --- a/t/helper/test-hashmap.c +++ b/t/helper/test-hashmap.c @@ -37,7 +37,7 @@ static struct test_entry *alloc_test_entry(unsigned int hash, size_t klen = strlen(key); size_t vlen = strlen(value); struct test_entry *entry = xmalloc(st_add4(sizeof(*entry), klen, vlen, 2)); - hashmap_entry_init(entry, hash); + hashmap_entry_init(&entry->ent, hash); memcpy(entry->key, key, klen + 1); memcpy(entry->key + klen + 1, value, vlen + 1); return entry; @@ -103,7 +103,7 @@ static void perf_hashmap(unsigned int method, unsigned int rounds) /* add entries */ for (i = 0; i < TEST_SIZE; i++) { - hashmap_entry_init(entries[i], hashes[i]); + hashmap_entry_init(&entries[i]->ent, hashes[i]); hashmap_add(&map, entries[i]); } @@ -116,7 +116,7 @@ static void perf_hashmap(unsigned int method, unsigned int rounds) /* fill the map (sparsely if specified) */ j = (method & TEST_SPARSE) ? TEST_SIZE / 10 : TEST_SIZE; for (i = 0; i < j; i++) { - hashmap_entry_init(entries[i], hashes[i]); + hashmap_entry_init(&entries[i]->ent, hashes[i]); hashmap_add(&map, entries[i]); } |
