[PATCH] Remove superfluous if(p!=NULL) checks around free(p); p=NULL;
Matt Turner
mattst88 at gmail.com
Wed Nov 10 08:26:32 PST 2010
On Wed, Nov 10, 2010 at 11:20 AM, Cyril Brulebois <kibi at debian.org> wrote:
> 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.
Oh, don't apologize. I was merely curious. Maybe someone would already
know of a semantic patch that's floated around LKML to do this. For
every patch like this I see, I become less and less confident that
we've found them all.
Matt
More information about the xorg-devel
mailing list