NetBSD-Bugs archive

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

Re: misc/49272: Patching with Coccinelle?: Deletion of unnecessary checks before specific function calls



The following reply was made to PR misc/49272; it has been noted by GNATS.

From: Markus Elfring <Markus.Elfring%web.de@localhost>
To: gnats-bugs%NetBSD.org@localhost, misc-bug-people%netbsd.org@localhost, 
 gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Cc: 
Subject: Re: misc/49272: Patching with Coccinelle?: Deletion of unnecessary
 checks before specific function calls
Date: Tue, 14 Oct 2014 20:30:23 +0200

 >  OK, so you want to change
 >  
 >  	if (x)
 >  		free(x);
 >  
 >  to just
 >  
 >  	free(x);
 >  
 >  and similarly for some functions other than free(), based on the 
 >  idea that free() itself checks the pointer.
 
 Yes. - This is my general idea here.
 
 
 >  It would have been nice if you had actually said that, instead of making
 >  us read several web pages.
 
 I try to offer a general solution for such a software development detail.
 
 
 >  Performing the test in the caller saves the function call overhead,
 >  and has no down side at all that I can see.
 
 I find that the desire for such overhead avoidance is inappropriate at the
 source code places which I could immediately show with the help of automatically
 generated patches.
 I prefer to reduce unwanted run time consequences from unneeded safety checks.
 
 Regards,
 Markus
 



Home | Main Index | Thread Index | Old Index