Re: [PATCH v3 13/13] Use new HASHMAP_INIT macro to simplify hashmap initialization

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

 



On Mon, Nov 02, 2020 at 06:55:13PM +0000, Elijah Newren via GitGitGadget wrote:

> From: Elijah Newren <newren@xxxxxxxxx>
> 
> Now that hashamp has lazy initialization and a HASHMAP_INIT macro,
> hashmaps allocated on the stack can be initialized without a call to
> hashmap_init() and in some cases makes the code a bit shorter.  Convert
> some callsites over to take advantage of this.

These all look obviously correct. I suspect there are more, but there's
no need for us to be thorough at this point.

> --- a/range-diff.c
> +++ b/range-diff.c
> @@ -232,11 +232,9 @@ static int patch_util_cmp(const void *dummy, const struct patch_util *a,
>  
>  static void find_exact_matches(struct string_list *a, struct string_list *b)
>  {
> -	struct hashmap map;
> +	struct hashmap map = HASHMAP_INIT((hashmap_cmp_fn)patch_util_cmp, NULL);

Not related to your patch, but we should in general try to define these
comparison functions with the correct signature, rather than cast them.

I think I've already inflated your series enough, so let's leave it for
now, but just a mental note that it might be useful to circle back and
fix these en masse (I know we cleaned up several a while back, so I'm
actually surprised to see one still here).

-Peff



[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