Re: [PATCH v2 18/27] revisions API: have release_revisions() release "cmdline"

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

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:

> in-flight semantic conflicts.
>
> 1. https://lore.kernel.org/git/YUj%2FgFRh6pwrZalY@xxxxxxxxxxxxxx/
> 2. https://lore.kernel.org/git/87o88obkb1.fsf@xxxxxxxxxxxxxxxxxxx/
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
>
> fixup with bc0e0439040?

WTH is this line?

> diff --git a/revision.c b/revision.c
> index d9e2b171f6d..f44298299a4 100644
> --- a/revision.c
> +++ b/revision.c
> @@ -2933,6 +2933,17 @@ static void release_revisions_commit_list(struct rev_info *revs)
>  	revs->commits = NULL;
>  }
>  
> +static void release_revisions_cmdline(struct rev_cmdline_info *cmdline)
> +{
> +	unsigned int i;
> +
> +	if (!cmdline)
> +		return;
> +	for (i = 0; i < cmdline->nr; i++)
> +		free((char *)cmdline->rev[i].name);
> +	FREE_AND_NULL(cmdline->rev);
> +}
> +
>  static void release_revisions_mailmap(struct string_list *mailmap)
>  {
>  	if (!mailmap)
> @@ -2947,6 +2958,7 @@ void release_revisions(struct rev_info *revs)
>  		return;
>  	release_revisions_commit_list(revs);
>  	object_array_clear(&revs->pending);
> +	release_revisions_cmdline(&revs->cmdline);
>  	release_revisions_mailmap(revs->mailmap);
>  }

That patch is quite unexpectedly small ;-)

When I created cmdline, I recall liberally stuffing borrowed strings
in the array, sort-of knowinly making it unnecessarily hard to
"free".

Quite pleasing.





[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