]> git.ipfire.org Git - thirdparty/git.git/blobdiff - submodule-config.c
Merge branch 'sg/commit-graph-usage-fix'
[thirdparty/git.git] / submodule-config.c
index 5463729ab87b1847f414e90705cc0100b7cd998d..401a9b238254385aae6f801eabbef6442d4b9292 100644 (file)
@@ -99,12 +99,12 @@ static void submodule_cache_clear(struct submodule_cache *cache)
         * allocation of struct submodule entries. Each is allocated by
         * their .gitmodules blob sha1 and submodule name.
         */
-       hashmap_iter_init(&cache->for_name, &iter);
-       while ((entry = hashmap_iter_next(&iter)))
+       hashmap_for_each_entry(&cache->for_name, &iter, entry,
+                               ent /* member name */)
                free_one_config(entry);
 
-       hashmap_free(&cache->for_path, 1);
-       hashmap_free(&cache->for_name, 1);
+       hashmap_free_entries(&cache->for_path, struct submodule_entry, ent);
+       hashmap_free_entries(&cache->for_name, struct submodule_entry, ent);
        cache->initialized = 0;
        cache->gitmodules_read = 0;
 }
@@ -141,7 +141,7 @@ static void cache_remove_path(struct submodule_cache *cache,
        struct submodule_entry *removed;
        hashmap_entry_init(&e.ent, hash);
        e.config = submodule;
-       removed = hashmap_remove(&cache->for_path, &e.ent, NULL);
+       removed = hashmap_remove_entry(&cache->for_path, &e, ent, NULL);
        free(removed);
 }
 
@@ -170,8 +170,7 @@ static const struct submodule *cache_lookup_path(struct submodule_cache *cache,
        hashmap_entry_init(&key.ent, hash);
        key.config = &key_config;
 
-       entry = hashmap_get_entry(&cache->for_path, &key, NULL,
-                               struct submodule_entry, ent);
+       entry = hashmap_get_entry(&cache->for_path, &key, ent, NULL);
        if (entry)
                return entry->config;
        return NULL;
@@ -191,8 +190,7 @@ static struct submodule *cache_lookup_name(struct submodule_cache *cache,
        hashmap_entry_init(&key.ent, hash);
        key.config = &key_config;
 
-       entry = hashmap_get_entry(&cache->for_name, &key, NULL,
-                               struct submodule_entry, ent);
+       entry = hashmap_get_entry(&cache->for_name, &key, ent, NULL);
        if (entry)
                return entry->config;
        return NULL;
@@ -556,7 +554,9 @@ static const struct submodule *config_from(struct submodule_cache *cache,
                struct hashmap_iter iter;
                struct submodule_entry *entry;
 
-               entry = hashmap_iter_first(&cache->for_name, &iter);
+               entry = hashmap_iter_first_entry(&cache->for_name, &iter,
+                                               struct submodule_entry,
+                                               ent /* member name */);
                if (!entry)
                        return NULL;
                return entry->config;