[PATCH] Remove superfluous if(p!=NULL) checks around free(p); p=NULL;

Cyril Brulebois kibi at debian.org
Wed Nov 10 08:20:10 PST 2010


Matt Turner <mattst88 at gmail.com> (10/11/2010):
> And good grief. Has anyone kept count of how many various incarnations
> of this patch there have been?
> 
> if (p) free(p);
> if (p != NULL) free(p);
> then with { }
> then add p = NULL or p = 0.
> 
> Is it possible to write a coccinelle patch to catch all of these cases?

Sorry, I've just started using coccinelle. I guess I could build a
“definitive” patch with all combinations we could think of and keep
that somewhere so that it can be run from time to time; but AFAICT
people like minimal changes at a time (though I understand that
conceptually we're just getting rid of extra conditionals, no matter
how they're written), that's why I went from trivial changes to
slightly less trivial changes.

Mraw,
KiBi.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20101110/96f7efd5/attachment.pgp>


More information about the xorg-devel mailing list