Re: [PATCH v2 08/19] hashmap_remove takes "const struct hashmap_entry *"
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Sep 25, 2019, 12:54 UTC
- Message-ID
- <d80f2000-3788-f422-e51a-9e3f6fff9f41@gmail.com>
- In-Reply-To
- <20190924010324.22619-9-e@80x24.org>
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]
Show 25 quoted lines
> diff --git a/hashmap.c b/hashmap.c
> index 092236c09a..bdf33e0381 100644
> --- a/hashmap.c
> +++ b/hashmap.c
> @@ -218,7 +218,8 @@ void hashmap_add(struct hashmap *map, struct hashmap_entry *entry)
> }
> }
>
> -void *hashmap_remove(struct hashmap *map, const void *key, const void *keydata)
> +void *hashmap_remove(struct hashmap *map, const struct hashmap_entry *key,
> + const void *keydata)
> {
> struct hashmap_entry *old;
> struct hashmap_entry **e = find_entry_ptr(map, key, keydata);
> diff --git a/hashmap.h b/hashmap.h
> index 2a4b4a3954..5e0818c134 100644
> --- a/hashmap.h
> +++ b/hashmap.h
> @@ -349,7 +349,7 @@ void *hashmap_put(struct hashmap *map, void *entry);
> *
> * Argument explanation is the same as in `hashmap_get`.
> */
> -void *hashmap_remove(struct hashmap *map, const void *key,
> +void *hashmap_remove(struct hashmap *map, const struct hashmap_entry *key,
> const void *keydata);In my effort to continue being detail-oriented, I'll point out whitespace alignment again here. But then I'll stop mentioning it for hashmap.[c|h] and leave it to you for a potential v3.
Thanks, -Stolee