threads / patch / 41693

patchsubmodule-config: use hashmap_iter_init()

Subject: [PATCH] submodule-config: use hashmap_iter_init()

## tl;dr

4 messages between Mar 15, 2016 and Mar 15, 2016. Diffs are folded; open one to read it.

replies: 3people: 3as markdown or json

Alexander Kuleshov· Mar 15, 2016, 18:25 UTC · lore
from the <hashmap.h> for simplification.
---
 submodule-config.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Show changes to submodule-config.c +1 −2
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
Eric Sunshine· Mar 15, 2016, 18:58 UTC · re: Alexander Kuleshov · lore

Re: [PATCH] submodule-config: use hashmap_iter_init()

On Tue, Mar 15, 2016 at 2:25 PM, Alexander Kuleshov <kuleshovmail@gmail.com> wrote:

> submodule-config: use hashmap_iter_init()
Did you mean s/init/first/ ?
> from the <hashmap.h> for simplification.
Sentence fragment...
Missing sign-off.
Show 16 quoted lines
> ---
> 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;
> --
Stefan Beller· Mar 15, 2016, 19:08 UTC · re: Eric Sunshine · lore

Re: [PATCH] submodule-config: use hashmap_iter_init()

On Tue, Mar 15, 2016 at 11:58 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 24 quoted lines
> On Tue, Mar 15, 2016 at 2:25 PM, Alexander Kuleshov
> <kuleshovmail@gmail.com> wrote:
>> submodule-config: use hashmap_iter_init()
>
> Did you mean s/init/first/ ?
>
>> from the <hashmap.h> for simplification.
>
> Sentence fragment...
>
> Missing sign-off.
>
>> ---
>> 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);
The change looks correct to me. But as Eric said, the commit message
needs work and a sign off. With that,
Reviewed-by: Stefan Beller <sbeller@google.com>

Thanks, Stefan

Alexander Kuleshov· Mar 15, 2016, 19:10 UTC · re: Stefan Beller · lore

Re: [PATCH] submodule-config: use hashmap_iter_init()

On Wed, Mar 16, 2016 at 1:08 AM, Stefan Beller <sbeller@google.com> wrote:
> The change looks correct to me. But as Eric said, the commit message
> needs work and a sign off. With that,
> Reviewed-by: Stefan Beller <sbeller@google.com>

Ah, yes, forgot to pass `-s` to commit command. Sorry for noise guys, will resend the patch.

← back to recent threads