git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] submodule-config: use hashmap_iter_first()
@ 2016-03-15 19:13 Alexander Kuleshov
  2016-03-15 19:21 ` Stefan Beller
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Kuleshov @ 2016-03-15 19:13 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git, Alexander Kuleshov

from the <hashmap.h> for simplification.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
---
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(-)

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] submodule-config: use hashmap_iter_first()
  2016-03-15 19:13 [PATCH v2] submodule-config: use hashmap_iter_first() Alexander Kuleshov
@ 2016-03-15 19:21 ` Stefan Beller
  2016-03-15 19:30   ` Eric Sunshine
  2016-03-15 21:55   ` Jeff King
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Beller @ 2016-03-15 19:21 UTC (permalink / raw)
  To: Alexander Kuleshov; +Cc: Junio C Hamano, Git

On Tue, Mar 15, 2016 at 12:13 PM, Alexander Kuleshov
<kuleshovmail@gmail.com> wrote:
> 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.



>
> Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
> Reviewed-by: Stefan Beller <sbeller@google.com>
> ---
> 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(-)
>
> 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] submodule-config: use hashmap_iter_first()
  2016-03-15 19:21 ` Stefan Beller
@ 2016-03-15 19:30   ` Eric Sunshine
  2016-03-15 21:55   ` Jeff King
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Sunshine @ 2016-03-15 19:30 UTC (permalink / raw)
  To: Stefan Beller; +Cc: Alexander Kuleshov, Junio C Hamano, Git

On Tue, Mar 15, 2016 at 3:21 PM, Stefan Beller <sbeller@google.com> wrote:
> On Tue, Mar 15, 2016 at 12:13 PM, Alexander Kuleshov
> <kuleshovmail@gmail.com> wrote:
>> 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.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] submodule-config: use hashmap_iter_first()
  2016-03-15 19:21 ` Stefan Beller
  2016-03-15 19:30   ` Eric Sunshine
@ 2016-03-15 21:55   ` Jeff King
  1 sibling, 0 replies; 4+ messages in thread
From: Jeff King @ 2016-03-15 21:55 UTC (permalink / raw)
  To: Stefan Beller; +Cc: Alexander Kuleshov, Junio C Hamano, Git

On Tue, Mar 15, 2016 at 12:21:36PM -0700, Stefan Beller wrote:

> On Tue, Mar 15, 2016 at 12:13 PM, Alexander Kuleshov
> <kuleshovmail@gmail.com> wrote:
> > 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.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-15 21:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-15 19:13 [PATCH v2] submodule-config: use hashmap_iter_first() Alexander Kuleshov
2016-03-15 19:21 ` Stefan Beller
2016-03-15 19:30   ` Eric Sunshine
2016-03-15 21:55   ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).