Subject: Re: [PATCH v3 0/2] Add a FREE_AND_NULL() wrapper macro

From: Junio C Hamano <[email-masked]>
Date: Thu, 15 Jun 2017 15:00:32 -0700

Ævar Arnfjörð Bjarmason  <[email-masked]> writes:

> On Thu, Jun 15 2017, Ævar Arnfjörð Bjarmason jotted:
>> I'll change it to FREE_AND_NULL and submit my patch as-is, my reading
>> of the rest of this thread is that making it a function instead of a
>> macro would be interesting, but has its own caveats that are likely
>> better considered as part of its own series, whereas this just changes
>> existing code to its macro-expanded functional equivalent.
>
> Here's v3 with that change. Nothing but the macro name (and comments,
> commit messages etc. referring to it) have changed.
>
> Ævar Arnfjörð Bjarmason (2):
>   git-compat-util: add a FREE_AND_NULL() wrapper around free(ptr); ptr =
>     NULL
>   *.[ch] refactoring: make use of the FREE_AND_NULL() macro

Thanks.

Perhaps somebody wants to do a follow-up patch on top of these two
patches to add .cocci rule e.g.

	@@
	type T;
	T *ptr;
	@@
	- free(ptr);
	- ptr = NULL;
	+ FREE_AND_NULL(ptr);

so that we can periodically sweep new candidates, to which this
macro can be applied?