diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2019-06-11 20:44:18 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2019-06-11 20:44:18 +0200 |
commit | 07a9a6d5c711426af787ffc38d16b9147062ab8a (patch) | |
tree | bd9bba3ed60af804eff2a9181430af75265faddd | |
parent | 787473ebd7079cf6cb285216310b169ff0fd2f85 (diff) |
reorder function
-rw-r--r-- | sfeed.c | 46 |
1 files changed, 23 insertions, 23 deletions
@@ -105,12 +105,12 @@ static void string_print_trimmed(String *); static void string_print_uri(String *); static void xmlattr(XMLParser *, const char *, size_t, const char *, size_t, const char *, size_t); +static void xmlattrentity(XMLParser *, const char *, size_t, const char *, + size_t, const char *, size_t); static void xmlattrend(XMLParser *, const char *, size_t, const char *, size_t); static void xmlattrstart(XMLParser *, const char *, size_t, const char *, size_t); -static void xmlattrentity(XMLParser *, const char *, size_t, const char *, - size_t, const char *, size_t); static void xmlcdata(XMLParser *, const char *, size_t); static void xmldata(XMLParser *, const char *, size_t); static void xmldataentity(XMLParser *, const char *, size_t); @@ -658,6 +658,26 @@ xmlattr(XMLParser *p, const char *t, size_t tl, const char *n, size_t nl, } static void +xmlattrentity(XMLParser *p, const char *t, size_t tl, const char *n, size_t nl, + const char *data, size_t datalen) +{ + char buf[16]; + ssize_t len; + + /* handles transforming inline XML to data */ + if (ISINCONTENT(ctx)) { + if (ctx.contenttype == ContentTypeHTML) + xmldata(p, data, datalen); + return; + } + + if ((len = xml_entitytostr(data, buf, sizeof(buf))) > 0) + xmlattr(p, t, tl, n, nl, buf, (size_t)len); + else + xmlattr(p, t, tl, n, nl, data, datalen); +} + +static void xmlattrend(XMLParser *p, const char *t, size_t tl, const char *n, size_t nl) { if (!ISINCONTENT(ctx) || ctx.contenttype != ContentTypeHTML) @@ -683,26 +703,6 @@ xmlattrstart(XMLParser *p, const char *t, size_t tl, const char *n, size_t nl) } static void -xmlattrentity(XMLParser *p, const char *t, size_t tl, const char *n, size_t nl, - const char *data, size_t datalen) -{ - char buf[16]; - ssize_t len; - - /* handles transforming inline XML to data */ - if (ISINCONTENT(ctx)) { - if (ctx.contenttype == ContentTypeHTML) - xmldata(p, data, datalen); - return; - } - - if ((len = xml_entitytostr(data, buf, sizeof(buf))) > 0) - xmlattr(p, t, tl, n, nl, buf, (size_t)len); - else - xmlattr(p, t, tl, n, nl, data, datalen); -} - -static void xmlcdata(XMLParser *p, const char *s, size_t len) { if (!ctx.field) @@ -903,9 +903,9 @@ main(int argc, char *argv[]) baseurl = argv[1]; parser.xmlattr = xmlattr; + parser.xmlattrentity = xmlattrentity; parser.xmlattrend = xmlattrend; parser.xmlattrstart = xmlattrstart; - parser.xmlattrentity = xmlattrentity; parser.xmlcdata = xmlcdata; parser.xmldata = xmldata; parser.xmldataentity = xmldataentity; |