On 12/26/2013 14:19, Shlomi Fish wrote:
Hi all,

happy holidays and a happy new (civil) year.

I'm the maintainer of XML::LibXSLT which are the CPAN bindings for libxslt.
Now, someone reported that the clang compiler emits some warnings, and part of
the problem was that I passed "1.0" to xmlNewDoc instead of its equivalent
"xmlChar *". So I did:

xmlChar * xml_ver = NULL;
xml_ver = xmlCharStrdup("1.0");
xmlNewDoc(xml_ver)

// At the function FINISH:
free( xml_ver );

Use xmlFree(). But for this particular case you don't need to allocate anything, just do xmlNewDoc(NULL).

How can I properly free a string allocated by xmlCharStrdup? The documentation
is lacking on details (and, if you ask me, should be made more explicit.).
You got all the code, for that case it's pretty simple.

Regards,

        Shlomi Fish


_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
https://mail.gnome.org/mailman/listinfo/xml

Reply via email to