[systemd-devel] [PATCH 2/2] hashmap.h: fix coding style issue

Daniel Buch boogiewasthere at gmail.com
Fri Apr 26 11:14:07 PDT 2013


I felt the inconsistentsy was kinda awfull.

I can change all to void* (instead of, void *) if you like but else leave
this patch to the trash?


2013/4/26 Kay Sievers <kay at vrfy.org>

> On Fri, Apr 26, 2013 at 7:49 PM, Zbigniew Jędrzejewski-Szmek
> <zbyszek at in.waw.pl> wrote:
> > On Fri, Apr 26, 2013 at 06:40:08PM +0200, Daniel Buch wrote:
> >> ---
> >>  src/shared/hashmap.h | 14 +++++++-------
> >>  1 file changed, 7 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/src/shared/hashmap.h b/src/shared/hashmap.h
> >> index 26bd030..f52517f 100644
> >> --- a/src/shared/hashmap.h
> >> +++ b/src/shared/hashmap.h
> >> @@ -57,11 +57,11 @@ int hashmap_ensure_allocated(Hashmap **h,
> hash_func_t hash_func, compare_func_t
> >>  int hashmap_put(Hashmap *h, const void *key, void *value);
> >>  int hashmap_update(Hashmap *h, const void *key, void *value);
> >>  int hashmap_replace(Hashmap *h, const void *key, void *value);
> >> -void* hashmap_get(Hashmap *h, const void *key);
> >> -void* hashmap_get2(Hashmap *h, const void *key, void **rkey);
> >> +void *hashmap_get(Hashmap *h, const void *key);
> >> +void *hashmap_get2(Hashmap *h, const void *key, void **rkey);
> >>  bool hashmap_contains(Hashmap *h, const void *key);
> >> -void* hashmap_remove(Hashmap *h, const void *key);
> >> -void* hashmap_remove_value(Hashmap *h, const void *key, void *value);
> >> +void *hashmap_remove(Hashmap *h, const void *key);
> >> +void *hashmap_remove_value(Hashmap *h, const void *key, void *value);
> >>  int hashmap_remove_and_put(Hashmap *h, const void *old_key, const void
> *new_key, void *value);
> >
> > I find the updated version actually harder to read. We seem to
> consistently
> > use 'char* xxx()', and 'void* xxx' is more common than 'void *xxx'.
>
> What's the point of the inconsistent:
>   void* hashmap_get(Hashmap *h, const void *key)
>
> it needs to be:
>   void* hashmap_get(Hashmap* h, const void* key)
>
> then, if we really go there. :)
>
> Kay
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20130426/83c8edf8/attachment.html>


More information about the systemd-devel mailing list