hashmap: hashmap_{put,remove} return hashmap_entry *
And add *_entry variants to perform container_of as necessary to simplify most callers. Signed-off-by: Eric Wong <e@80x24.org> Reviewed-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
87571c3f71
commit
8a973d0bb3
3
remote.c
3
remote.c
@ -162,7 +162,8 @@ static struct remote *make_remote(const char *name, int len)
|
||||
remotes[remotes_nr++] = ret;
|
||||
|
||||
hashmap_entry_init(&ret->ent, lookup_entry.hash);
|
||||
replaced = hashmap_put(&remotes_hash, &ret->ent);
|
||||
replaced = hashmap_put_entry(&remotes_hash, ret, struct remote,
|
||||
ent /* member name */);
|
||||
assert(replaced == NULL); /* no previous entry overwritten */
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user