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 /merge-recursive.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 'merge-recursive.c')
-rw-r--r-- | merge-recursive.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/merge-recursive.c b/merge-recursive.c index 6b812d67e3..6bc4f14ff4 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -61,7 +61,7 @@ static struct dir_rename_entry *dir_rename_find_entry(struct hashmap *hashmap, if (dir == NULL) return NULL; - hashmap_entry_init(&key, strhash(dir)); + hashmap_entry_init(&key.ent, strhash(dir)); key.dir = dir; return hashmap_get(hashmap, &key, NULL); } @@ -85,7 +85,7 @@ static void dir_rename_init(struct hashmap *map) static void dir_rename_entry_init(struct dir_rename_entry *entry, char *directory) { - hashmap_entry_init(entry, strhash(directory)); + hashmap_entry_init(&entry->ent, strhash(directory)); entry->dir = directory; entry->non_unique_new_dir = 0; strbuf_init(&entry->new_dir, 0); @@ -97,7 +97,7 @@ static struct collision_entry *collision_find_entry(struct hashmap *hashmap, { struct collision_entry key; - hashmap_entry_init(&key, strhash(target_file)); + hashmap_entry_init(&key.ent, strhash(target_file)); key.target_file = target_file; return hashmap_get(hashmap, &key, NULL); } @@ -454,7 +454,7 @@ static int save_files_dirs(const struct object_id *oid, strbuf_addstr(base, path); FLEX_ALLOC_MEM(entry, path, base->buf, base->len); - hashmap_entry_init(entry, path_hash(entry->path)); + hashmap_entry_init(&entry->e, path_hash(entry->path)); hashmap_add(&opt->current_file_dir_set, entry); strbuf_setlen(base, baselen); @@ -731,7 +731,7 @@ static char *unique_path(struct merge_options *opt, const char *path, const char } FLEX_ALLOC_MEM(entry, path, newpath.buf, newpath.len); - hashmap_entry_init(entry, path_hash(entry->path)); + hashmap_entry_init(&entry->e, path_hash(entry->path)); hashmap_add(&opt->current_file_dir_set, entry); return strbuf_detach(&newpath, NULL); } @@ -2358,7 +2358,8 @@ static void compute_collisions(struct hashmap *collisions, if (!collision_ent) { collision_ent = xcalloc(1, sizeof(struct collision_entry)); - hashmap_entry_init(collision_ent, strhash(new_path)); + hashmap_entry_init(&collision_ent->ent, + strhash(new_path)); hashmap_put(collisions, collision_ent); collision_ent->target_file = new_path; } else { |