sfeed

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

commit 1309b40bb5b92ef835ce48cf11c57721a5dbdbe7
parent 37f5dce067ff8a8445a81b3db53ed3173f39f226
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun, 23 Aug 2015 17:42:37 +0200

simplify unknown or less priority tag case, fix gettag bug (wrong sort order)

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

diff --git a/sfeed.c b/sfeed.c @@ -149,8 +149,8 @@ gettag(enum FeedType feedtype, const char *name, size_t namelen) { STRP("dc:date"), RSSTagDcdate }, { STRP("description"), RSSTagDescription }, { STRP("guid"), RSSTagGuid }, - { STRP("media:description"), RSSTagMediaDescription }, { STRP("link"), RSSTagLink }, + { STRP("media:description"), RSSTagMediaDescription }, { STRP("pubdate"), RSSTagPubdate }, { STRP("title"), RSSTagTitle }, { NULL, 0, -1 } @@ -622,15 +622,11 @@ xml_handler_start_el(XMLParser *p, const char *name, size_t namelen) /* in item */ tagid = gettag(ctx.feedtype, name, namelen); ctx.tagid = tagid; - if (tagid == TagUnknown) { - ctx.field = NULL; - return; - } - /* map tag type to field */ + /* map tag type to field: unknown or less priority is ignored. */ if (tagid <= ctx.fields[fieldmap[ctx.tagid]].tagid) { ctx.field = NULL; - return; /* priority */ + return; } ctx.iscontenttag = (fieldmap[ctx.tagid] == FieldContent); ctx.field = &(ctx.fields[fieldmap[ctx.tagid]].str);