sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 5c8840493f8cd52ba2224db6ed644f4933ac2212
parent 0bb808b9bc9c673a086bcb3c5129b3b0691dd063
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat, 16 May 2015 15:54:39 +0200

xml: attrentity handler will be called if set

it used to be if attrentity is NULL it would call attrdata.

Diffstat:
Mxml.c | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/xml.c b/xml.c @@ -82,7 +82,7 @@ xmlparser_parseattrs(XMLParser *x) if(x->xmlattrstart) x->xmlattrstart(x, x->tag, x->taglen, x->name, namelen); for(valuelen = 0; (c = xmlparser_getnext(x)) != EOF;) { - if(c == '&' && x->xmlattrentity) { /* entities */ + if(c == '&') { /* entities */ x->data[valuelen] = '\0'; /* call data function with data before entity if there is data */ if(valuelen && x->xmlattr) @@ -104,7 +104,8 @@ xmlparser_parseattrs(XMLParser *x) } if(c == ';') { x->data[valuelen] = '\0'; - x->xmlattrentity(x, x->tag, x->taglen, x->name, namelen, x->data, valuelen); + if(x->xmlattrentity) + x->xmlattrentity(x, x->tag, x->taglen, x->name, namelen, x->data, valuelen); valuelen = 0; break; } @@ -310,7 +311,7 @@ xmlparser_parse(XMLParser *x) if(x->xmldatastart) x->xmldatastart(x); while((c = xmlparser_getnext(x)) != EOF) { - if(c == '&' && x->xmldataentity) { + if(c == '&') { if(datalen) { x->data[datalen] = '\0'; x->xmldata(x, x->data, datalen); @@ -326,7 +327,8 @@ xmlparser_parse(XMLParser *x) break; else if(c == ';') { x->data[datalen] = '\0'; - x->xmldataentity(x, x->data, datalen); + if(x->xmldataentity) + x->xmldataentity(x, x->data, datalen); datalen = 0; break; }