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

4 messages from 2016-03-15 to 2016-03-15. Participants: Alexander Kuleshov, Eric Sunshine, Stefan Beller.
Thread: https://gitlist.dev/t/41693

## Alexander Kuleshov, 2016-03-15 18:25

Subject: [PATCH] submodule-config: use hashmap_iter_init()
Message-ID: <1458066330-5107-1-git-send-email-kuleshovmail@gmail.com>
URL: https://gitlist.dev/e/1458066330-5107-1-git-send-email-kuleshovmail%40gmail.com

```
from the <hashmap.h> for simplification.
---
 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

```

## Eric Sunshine, 2016-03-15 18:58

Subject: Re: [PATCH] submodule-config: use hashmap_iter_init()
Message-ID: <CAPig+cR6Cy2MHvoTxNa89gZx9qJZW1Rv93N+wcwK2JRGkUBzRw@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcR6Cy2MHvoTxNa89gZx9qJZW1Rv93N%2BwcwK2JRGkUBzRw%40mail.gmail.com
In-Reply-To: <1458066330-5107-1-git-send-email-kuleshovmail@gmail.com>

```
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);
>                 if (!entry)
>                         return NULL;
>                 return entry->config;
> --

```

## Stefan Beller, 2016-03-15 19:08

Subject: Re: [PATCH] submodule-config: use hashmap_iter_init()
Message-ID: <CAGZ79kZH_xzfvo=cP_+BdsqpthwQUKkJjo7OawkpFN9y+jm_+w@mail.gmail.com>
URL: https://gitlist.dev/e/CAGZ79kZH_xzfvo%3DcP_%2BBdsqpthwQUKkJjo7OawkpFN9y%2Bjm_%2Bw%40mail.gmail.com
In-Reply-To: <CAPig+cR6Cy2MHvoTxNa89gZx9qJZW1Rv93N+wcwK2JRGkUBzRw@mail.gmail.com>

```
On Tue, Mar 15, 2016 at 11:58 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> 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, 2016-03-15 19:10

Subject: Re: [PATCH] submodule-config: use hashmap_iter_init()
Message-ID: <CANCZXo7OBe_+udjGXQbe6YpZK8Ln113J=PZ59MnwQq7E8jwYLA@mail.gmail.com>
URL: https://gitlist.dev/e/CANCZXo7OBe_%2BudjGXQbe6YpZK8Ln113J%3DPZ59MnwQq7E8jwYLA%40mail.gmail.com
In-Reply-To: <CAGZ79kZH_xzfvo=cP_+BdsqpthwQUKkJjo7OawkpFN9y+jm_+w@mail.gmail.com>

```
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.

```
