a parse_str function that frees its argument automatically
Status: Beta
Brought to you by:
voisine
A function like ezxml_parse_alloc_str would be convenient that takes ownership of the given string, like:
// parse the given allocated xml string (that is freed automatically on
// ezxml_free) and return an ezxml structure
ezxml_t ezxml_parse_alloc_str(char *s, size_t len)
{
ezxml_root_t root;
root = (ezxml_root_t)ezxml_parse_str(s, len);
root->len = -1; // so we know to free s in ezxml_free()
return &root->xml;
}