sfeed

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

commit 6bc48bb27a50d711cb104d010998a1c1cee6e8d2
parent 84831ac69e9a20800a50a902aa5e7000168f3d45
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri, 14 Aug 2015 17:03:53 +0200

minor code-style improvements

Diffstat:
Msfeed.c | 2+-
Msfeed_update | 4++--
Mxml.c | 9++++-----
3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/sfeed.c b/sfeed.c @@ -147,7 +147,7 @@ gettag(enum FeedType feedtype, const char *name, size_t namelen) for (i = 0; tags[i].name; i++) { if (!(n = strcasecmp(tags[i].name, name))) return tags[i].id; /* found */ - /* optimization: it's sorted so nothing after it matches. */ + /* optimization: tags are sorted so nothing after matches. */ if (n > 0) return TagUnknown; } diff --git a/sfeed_update b/sfeed_update @@ -42,9 +42,9 @@ merge() { # fetchfeed(url, name, feedfile) fetchfeed() { if curl -f -s -S --max-time 15 -z "$3" "$1"; then - printf " OK %s %s\n" "`date +'%H:%M:%S'`" "$2" >&2 + printf " OK %s %s\n" "$(date +'%H:%M:%S')" "$2" >&2 else - printf "FAIL %s %s\n" "`date +'%H:%M:%S'`" "$2" >&2 + printf "FAIL %s %s\n" "$(date +'%H:%M:%S')" "$2" >&2 fi } diff --git a/xml.c b/xml.c @@ -388,20 +388,19 @@ xml_parse(XMLParser *x) if (c == '>') break; else if (c == '-' && tagdatalen == sizeof("--") - 1 && - (x->data[0] == '-')) { /* comment */ + (x->data[0] == '-')) { xml_parsecomment(x); break; } else if (c == '[') { if (tagdatalen == sizeof("[CDATA[") - 1 && - x->data[1] == 'C' && x->data[2] == 'D' && - x->data[3] == 'A' && x->data[4] == 'T' && - x->data[5] == 'A' && x->data[6] == '[') { /* CDATA */ + !strncmp(x->data, "[CDATA[", tagdatalen)) { xml_parsecdata(x); break; } } } - } else { /* normal tag (open, short open, close), processing instruction. */ + } else { + /* normal tag (open, short open, close), processing instruction. */ if (isspace(c)) while ((c = xml_getnext(x)) != EOF && isspace(c)) ;