[packages] ezxml: update PKG_RELEASE and rename patches
[openwrt/svn-archive/archive.git] / libs / ezxml / patches / 200-ezxml_parse_str.patch
1 --- a/ezxml.c
2 +++ b/ezxml.c
3 @@ -599,6 +599,19 @@ ezxml_t ezxml_parse_str(char *s, size_t
4 else return ezxml_err(root, d, "unclosed tag <%s>", root->cur->name);
5 }
6
7 +// parse the given xml string and return an ezxml structure
8 +ezxml_t ezxml_parse_str_d(char const *_s, size_t len)
9 +{
10 + ezxml_root_t root;
11 + char *s;
12 +
13 + if (! (s = strndup(_s, len))) return NULL;
14 +
15 + root = (ezxml_root_t)ezxml_parse_str(s, strlen(s));
16 + root->len = -1; // so we know to free s in ezxml_free()
17 + return &root->xml;
18 +}
19 +
20 // Wrapper for ezxml_parse_str() that accepts a file stream. Reads the entire
21 // stream into memory and then parses it. For xml files, use ezxml_parse_file()
22 // or ezxml_parse_fd()
23 --- a/ezxml.h
24 +++ b/ezxml.h
25 @@ -59,6 +59,11 @@ struct ezxml {
26 // pass in the copy. Returns NULL on failure.
27 ezxml_t ezxml_parse_str(char *s, size_t len);
28
29 +// Given a string of xml data and its length, parses it and creates an ezxml
30 +// structure. that strdup()s s
31 +// Returns NULL on failure.
32 +ezxml_t ezxml_parse_str_d(char const *s, size_t len);
33 +
34 // A wrapper for ezxml_parse_str() that accepts a file descriptor. First
35 // attempts to mem map the file. Failing that, reads the file into memory.
36 // Returns NULL on failure.