Menu

#2 a parse_str function that frees its argument automatically

open
nobody
None
5
2014-12-01
2014-12-01
netcat
No

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;
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.