Re: [RFC PATCH] hashmap API: introduce for_each_hashmap_entry() helper macro

2016-03-19 Thread Karsten Blees
Am 16.03.2016 um 17:39 schrieb Alexander Kuleshov: > There is common pattern to traverse a hashmap in git source code: > > hashmap_iter_init(map, &iter); > while ((entry = hashmap_iter_next(&iter))) > // do something with entry > The hashmap_iter_first() function al

[RFC PATCH] hashmap API: introduce for_each_hashmap_entry() helper macro

2016-03-19 Thread Alexander Kuleshov
There is common pattern to traverse a hashmap in git source code: hashmap_iter_init(map, &iter); while ((entry = hashmap_iter_next(&iter))) // do something with entry This patch introduces the for_each_hashmap_entry() macro for more simple and clean usage of this patt

Re: [RFC PATCH] hashmap API: introduce for_each_hashmap_entry() helper macro

2016-03-18 Thread Alexander Kuleshov
Hello Junio, On Thu, Mar 17, 2016 at 12:09 AM, Junio C Hamano wrote: > Alexander Kuleshov writes: > >> diff --git a/hashmap.h b/hashmap.h >> index ab7958a..b8b158c 100644 >> --- a/hashmap.h >> +++ b/hashmap.h >> @@ -95,4 +95,11 @@ static inline const char *strintern(const char *string) >>

Re: [RFC PATCH] hashmap API: introduce for_each_hashmap_entry() helper macro

2016-03-18 Thread Junio C Hamano
Alexander Kuleshov writes: > diff --git a/hashmap.h b/hashmap.h > index ab7958a..b8b158c 100644 > --- a/hashmap.h > +++ b/hashmap.h > @@ -95,4 +95,11 @@ static inline const char *strintern(const char *string) > return memintern(string, strlen(string)); > } > > +#define for_each_hashmap_e