Browse Source

submodule-config: use hashmap_iter_first()

The hashmap API provides hashmap_iter_first() helper for initialion
and getting the first entry of a hashmap. Let's use it instead of
doing initialization manually and then get the first entry.

There are no functional changes, just cleanup.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Alexander Kuleshov 9 years ago committed by Junio C Hamano
parent
commit
01d98e8a5d
  1. 3
      submodule-config.c

3
submodule-config.c

@ -392,8 +392,7 @@ static const struct submodule *config_from(struct submodule_cache *cache, @@ -392,8 +392,7 @@ static const struct submodule *config_from(struct submodule_cache *cache,
struct hashmap_iter iter;
struct submodule_entry *entry;

hashmap_iter_init(&cache->for_name, &iter);
entry = hashmap_iter_next(&iter);
entry = hashmap_iter_first(&cache->for_name, &iter);
if (!entry)
return NULL;
return entry->config;

Loading…
Cancel
Save