I've noticed that a_Url_free() and a_Image_unref() both guard against being passed a NULL argument, yet in several cases the code that calls these functions also checks for a NULL, which is redundant. I think that if the API officially accepts NULL then code that calls the API shouldn't be checking for it. Conversely, if the API does not accept NULL then its implementation shouldn't be checking for it. So I would suggest we remove the redundancy by eliminating the NULL check from either the callers or the API implementation. Thoughts? I'll provide patches if people agree and decide whether or not these APIs should support NULL. Regards, Jeremy Henty
On Sun, May 03, 2009 at 11:27:14AM +0100, Jeremy Henty wrote:
I've noticed that a_Url_free() and a_Image_unref() both guard against being passed a NULL argument, yet in several cases the code that calls these functions also checks for a NULL, which is redundant. I think that if the API officially accepts NULL then code that calls the API shouldn't be checking for it. Conversely, if the API does not accept NULL then its implementation shouldn't be checking for it. So I would suggest we remove the redundancy by eliminating the NULL check from either the callers or the API implementation. Thoughts? I'll provide patches if people agree and decide whether or not these APIs should support NULL.
In general the API accepts NULL (e.g. dlib), so please remove the redundant checks outside it. -- Cheers Jorge.-
On Sun, May 03, 2009 at 09:35:34AM -0400, Jorge Arellano Cid wrote:
On Sun, May 03, 2009 at 11:27:14AM +0100, Jeremy Henty wrote:
... a_Url_free() and a_Image_unref() both guard against being passed a NULL argument, yet in several cases the code that calls these functions also checks for a NULL, which is redundant.
In general the API accepts NULL (e.g. dlib), so please remove the redundant checks outside it.
OK, patches attached. Regards, Jeremy Henty
On Sun, May 03, 2009 at 05:16:31PM +0100, Jeremy Henty wrote:
On Sun, May 03, 2009 at 09:35:34AM -0400, Jorge Arellano Cid wrote:
On Sun, May 03, 2009 at 11:27:14AM +0100, Jeremy Henty wrote:
... a_Url_free() and a_Image_unref() both guard against being passed a NULL argument, yet in several cases the code that calls these functions also checks for a NULL, which is redundant.
In general the API accepts NULL (e.g. dlib), so please remove the redundant checks outside it.
OK, patches attached.
Committed! -- Cheers Jorge.-
participants (2)
-
jcid@dillo.org
-
onepoint@starurchin.org