Re: [PATCH v2 07/19] hashmap_get takes "const struct hashmap_entry *"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

(I'm really struggling to find things wrong with this series. Am I not
reading it correctly, or is it just that good?)

Thanks,
-Stolee



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux