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. ------------------------------------------------------------------------- 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