Skip to contentSkip to conversation

submodule-config: use hashmap_iter_first()

PATCH Superseded Alexander Kuleshov 4 participants 4 messages Jun 15, 2016

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 submodule-config: use hashmap_iter_first()

from the <hashmap.h> for simplification.

---
Changelog: added missed Signof-off-by and function name fixed in the commit message.

 submodule-config.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
submodule-config.c +1 -2
index b82d1fb..8ac5031 100644
@@ -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;
Signature · 1 line
2.8.0.rc2.216.g1477fb2.dirty
#1 lore raw
Quoted 1 line · Alexander Kuleshov

from the <hashmap.h> for simplification.

I think what Eric wanted to point out, was to not have a continuous sentence from commit message header to body.

Either leave the body blank (as it is obvious) or write a whole sentence there:

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

The hashmap API offers the hashmap_iter_first function as initializing and getting the first entry is a common pattern. Use that instead of
doing initialization
by hand and then get the first entry.

Quoted 31 lines

---
Changelog: added missed Signof-off-by and function name fixed in the commit message.

 submodule-config.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
submodule-config.c +1 -3
index b82d1fb..8ac5031 100644
@@ -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

--
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 7 lines · Stefan Beller
Quoted 1 line · Alexander Kuleshov

from the <hashmap.h> for simplification.

I think what Eric wanted to point out, was to not have a continuous sentence from commit message header to body.

Quoted 8 lines

Either leave the body blank (as it is obvious) or write a whole sentence there:

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

The hashmap API offers the hashmap_iter_first function as initializing and getting the first entry is a common pattern. Use that instead of
doing initialization
by hand and then get the first entry.

While we are nitpicking...:)

As a reader (either reviewing now, or looking at the change later in git-log), I think my biggest question is: why? Do we expect this to change behavior, or is this just a cleanup? There's nothing wrong with "just" a cleanup, but knowing that is the intent is helpful.

-Peff

#3 lore raw
In reply to Stefan Beller
Quoted 6 lines · Stefan Beller
Quoted 1 line · Alexander Kuleshov

from the <hashmap.h> for simplification.

I think what Eric wanted to point out, was to not have a continuous sentence from commit message header to body.

Yes, thanks for clarifying that.

Quoted 8 lines

Either leave the body blank (as it is obvious) or write a whole sentence there:

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

The hashmap API offers the hashmap_iter_first function as initializing and getting the first entry is a common pattern. Use that instead of
doing initialization
by hand and then get the first entry.