Stephen Warren wrote:
> On Mon, June 23, 2008 3:28 pm, Phil Dibowitz wrote:
>> Andreas Schulz wrote:
>>> Well, concordance could do that as well, so what about:
>>>   char **get_keynames(uint8_t *data, uint32_t size);
>>>   void destroy_keynames(char **names);
>>> and be done with the XML data in one call?
>> I don't think we need the call to destory() in this case.
> 
> I don't agree. Why should the client (or bindings) know how the memory was
> allocated, and hence how to free it. malloc() is common, but if the
> client/bindings simply assume this, and call free() on the data, things
> will break very horribly if libconcord was built using a debug malloc
> library that redefines malloc/free to be something else, and perhaps
> actually allocates a different (larger) sized chunk of memory in order to
> add debug information headers/trailers, meaning that the actual pointer
> passed to real free should be, say, 8 bytes less than that returned by the
> debug malloc.

Because you didn't ask for an LH type. You asked for a standard type.
Strings, ints, etc. I think are standard. It's a type your asking for,
*explicitly*, which means you *explicitly* understand it. Thus, you
explicitly know how to destroy it. And bindings can do that as well.

If you compile libconcord with a debug malloc/free you best recompile
the whole thing - including it's libraries.

-- 
Phil Dibowitz                             [EMAIL PROTECTED]
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Never write it in C if you can do it in 'awk';
 Never do it in 'awk' if 'sed' can handle it;
 Never use 'sed' when 'tr' can do the job;
 Never invoke 'tr' when 'cat' is sufficient;
 Avoid using 'cat' whenever possible" -- Taylor's Laws of Programming


Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel

Reply via email to