git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3] submodule-config: use hashmap_iter_first()

From
Alexander Kuleshov <kuleshovmail@gmail.com>
Date
Mar 16, 2016, 07:46 UTC
Message-ID
<1458114391-2235-1-git-send-email-kuleshovmail@gmail.com>

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>
---
Changelog v3: commit message edited.
 submodule-config.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/submodule-config.c b/submodule-config.c
index b82d1fb..8ac5031 100644
--- a/submodule-config.c
+++ b/submodule-config.c
@@ -405,8 +405,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;
-- 
2.8.0.rc2.216.g1477fb2.dirty
Message 1 of 1 in “submodule-config: use hashmap_iter_first()”
  1. submodule-config: use hashmap_iter_first()Alexander Kuleshov, Mar 16, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.