hashmap_get{,_from_hash} return "struct hashmap_entry *"

Update callers to use hashmap_get_entry, hashmap_get_entry_from_hash
or container_of as appropriate.

This is another step towards eliminating the requirement of
hashmap_entry being the first field in a struct.

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:
Eric Wong
2019-10-06 23:30:36 +00:00
committed by Junio C Hamano
parent f0e63c4113
commit f23a465132
20 changed files with 72 additions and 41 deletions

View File

@ -135,7 +135,7 @@ static struct remote *make_remote(const char *name, int len)
{
struct remote *ret, *replaced;
struct remotes_hash_key lookup;
struct hashmap_entry lookup_entry;
struct hashmap_entry lookup_entry, *e;
if (!len)
len = strlen(name);
@ -145,8 +145,9 @@ static struct remote *make_remote(const char *name, int len)
lookup.len = len;
hashmap_entry_init(&lookup_entry, memhash(name, len));
if ((ret = hashmap_get(&remotes_hash, &lookup_entry, &lookup)) != NULL)
return ret;
e = hashmap_get(&remotes_hash, &lookup_entry, &lookup);
if (e)
return container_of(e, struct remote, ent);
ret = xcalloc(1, sizeof(struct remote));
ret->prune = -1; /* unspecified */