Re: [PATCH v2 07/19] hashmap_get takes "const struct hashmap_entry *"
- From
- Eric Wong <e@80x24.org>
- Date
- Sep 30, 2019, 09:57 UTC
- Message-ID
- <20190930095749.GA24511@dcvr>
- In-Reply-To
- <9dc71ed0-617c-84e8-b7fc-0766f4d83695@gmail.com>
Derrick Stolee <stolee@gmail.com> wrote:
Show 38 quoted lines
> On 9/23/2019 9:03 PM, Eric Wong wrote:
> > This is less error-prone than "const void *" as the compiler
> > now detects invalid types being passed.
> [snip]
> > diff --git a/hashmap.h b/hashmap.h
> > index 40bcc64289..2a4b4a3954 100644
> > --- a/hashmap.h
> > +++ b/hashmap.h
> > @@ -74,7 +74,8 @@
> > * e->key = key;
> > *
> > * flags |= COMPARE_VALUE;
> > - * printf("%sfound\n", hashmap_get(&map, e, NULL) ? "" : "not ");
> > + * printf("%sfound\n",
> > + * hashmap_get(&map, &e->ent, NULL) ? "" : "not ");
> > * free(e);
> > * }
> > *
> > @@ -84,7 +85,8 @@
> > * k.key = key;
> > *
> > * flags |= COMPARE_VALUE;
> > - * printf("%sfound\n", hashmap_get(&map, &k, value) ? "" : "not ");
> > + * printf("%sfound\n",
> > + * hashmap_get(&map, &k->ent, value) ? "" : "not ");
> > * }
> > *
> > * if (!strcmp("end", action)) {
> > @@ -286,7 +288,7 @@ static inline unsigned int hashmap_get_size(struct hashmap *map)
> > * If an entry with matching hash code is found, `key` and `keydata` are passed
> > * to `hashmap_cmp_fn` to decide whether the entry matches the key.
> > */
> > -void *hashmap_get(const struct hashmap *map, const void *key,
> > +void *hashmap_get(const struct hashmap *map, const struct hashmap_entry *key,
> > const void *keydata);
>
> super-nit: the whitespace before the second line is "\t\t\t " but should be
> "\t\t ".Huh? Do you mean the "const void *keydata);" line? That's context and unchanged from before. Thanks.