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

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

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> 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?



[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]