On Thu, Mar 22, 2007 at 12:22:13PM +0100, Jim Meyering wrote:
David Edmondson <dme(a)sun.com> wrote:
> On Wed, Mar 21, 2007 at 04:38:00PM +0100, Jim Meyering wrote:
>> I interpret "wrappers", above, to mean more than just a calloc-like
wrapper.
>>
>> A malloc (not calloc, of course) wrapper that always initializes can
>> mask what would have otherwise been a used-uninitialised error, and what
>> would still be a logical U.I. error.
And did that only in special compilation mode.
> That seems silly. If the wrapper is defined as zero-initalising
then
> it cannot be an error to assume that it zero-initalises.
What seems silly? A malloc() wrapper that initializes the
memory it allocates? That's the case in which errors can be masked.
A function intended to be used as a malloc or realloc replacement should
not initialize its memory -- at least not by default. A calloc-wrapper
_must_ do that. Not the others.
Before jumping on this and creating a out of scope thread out of a passing
remark, please check the source of what I was comparing to and why in context.
The purpose has never been to have a memory wrapper initialize the memory
all the time.
References:
http://xmlsoft.org/html/libxml-xmlmemory.html
http://xmlsoft.org/xmlmem.html#Debugging
If you want to debate this I rather suggest to do this on libxml2 mailing
list since this was never the intent on libvirt.
http://xmlsoft.org/bugs.html
thanks,
Daniel
--
Red Hat Virtualization group
http://redhat.com/virtualization/
Daniel Veillard | virtualization library
http://libvirt.org/
veillard(a)redhat.com | libxml GNOME XML XSLT toolkit
http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine
http://rpmfind.net/