sfeed

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

commit 91ed017ca773e14d128d4a8c0edb8654b333214e
parent f62993ca41830aaa55a0e985f10ecc4fd55eda44
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri, 14 Dec 2018 12:49:00 +0100

sfeed: rename buffer to buf, change entitytostr check, it can never happen

Diffstat:
Msfeed.c | 11+++--------
1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/sfeed.c b/sfeed.c @@ -641,7 +641,7 @@ xml_handler_data(XMLParser *p, const char *s, size_t len) static void xml_handler_data_entity(XMLParser *p, const char *data, size_t datalen) { - char buffer[16]; + char buf[16]; ssize_t len; if (!ctx.field) @@ -649,13 +649,8 @@ xml_handler_data_entity(XMLParser *p, const char *data, size_t datalen) /* try to translate entity, else just pass as data to * xml_data_handler. */ - len = xml_entitytostr(data, buffer, sizeof(buffer)); - /* this should never happen (buffer too small) */ - if (len < 0) - return; - - if (len > 0) - xml_handler_data(p, buffer, (size_t)len); + if ((len = xml_entitytostr(data, buf, sizeof(buf))) > 0) + xml_handler_data(p, buf, (size_t)len); else xml_handler_data(p, data, datalen); }