Re: kfree(NULL)

From: Jan Engelhardt
Date: Sat Apr 22 2006 - 16:23:19 EST


>> > I don't actually like kfree(NULL) any time except error paths. It is
>> > subjective, not crazy talk.
>>
>> Documented interface is not subjective.
>
> That's great. I don't know quite how to reply, or even if I should
> if you don't read what I write.

Where's the problem, if a developer does not know whether an object is NULL
or not, he may call kfree(). If, on the other hand, he is sure it is NULL,
there is no need to refree it, and if he is sure it is non-NULL, he can
directly call __kfree(). So the readability can never suffer - you never
need an if(x==NULL) anymore.


Jan Engelhardt
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/