Thread (8 messages) 8 messages, 2 authors, 2017-06-15

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

flat view

From: Junio C Hamano <hidden>
Date: 2017-06-15 22:00:39

Possibly related (same subject, not in this thread)

Ævar Arnfjörð Bjarmason  [off-list ref] writes:
On Thu, Jun 15 2017, Ævar Arnfjörð Bjarmason jotted:
quoted
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?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help