sfeed

simple feed reader - forked from git.codemadness.org/sfeed
git clone git://src.gearsix.net/sfeed
Log | Files | Refs | Atom | README | LICENSE

commit c8ab809bf4cf94add2e9abe4d41735dd76cd6c83
parent b975dc5c1bf650f8f38f229bf6ee7916961ded9f
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Mon, 25 May 2015 21:24:41 +0200

string_buffer_realloc: doesnt return

Diffstat:
Msfeed.c | 15++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/sfeed.c b/sfeed.c @@ -87,7 +87,7 @@ static int parsetime(const char *, char *, size_t, time_t *); static void printfields(void); static void string_append(String *, const char *, size_t); static void string_buffer_init(String *, size_t); -static int string_buffer_realloc(String *, size_t); +static void string_buffer_realloc(String *, size_t); static void string_clear(String *); static void string_print(String *); static void xml_handler_attr(XMLParser *, const char *, size_t, @@ -282,7 +282,7 @@ string_buffer_init(String *s, size_t len) string_clear(s); } -static int +static void string_buffer_realloc(String *s, size_t newlen) { char *p; @@ -294,7 +294,6 @@ string_buffer_realloc(String *s, size_t newlen) err(1, "realloc"); s->bufsiz = alloclen; s->data = p; - return s->bufsiz; } static void @@ -624,6 +623,7 @@ xml_handler_start_element(XMLParser *p, const char *name, size_t namelen) ctx.tagid = gettag(ctx.item.feedtype, ctx.tag, ctx.taglen); if(ctx.tagid == TagUnknown) ctx.field = NULL; + if(ctx.item.feedtype == FeedTypeRSS) { if(ctx.tagid == RSSTagPubdate || ctx.tagid == RSSTagDcdate) ctx.field = &ctx.item.timestamp; @@ -643,9 +643,6 @@ xml_handler_start_element(XMLParser *p, const char *name, size_t namelen) } else if(ctx.tagid == RSSTagAuthor || ctx.tagid == RSSTagDccreator) { ctx.field = &ctx.item.author; } - /* clear field */ - if(ctx.field) - string_clear(ctx.field); } else if(ctx.item.feedtype == FeedTypeAtom) { if(ctx.tagid == AtomTagPublished || ctx.tagid == AtomTagUpdated) { /* ignore, prefer updated over published */ @@ -667,10 +664,10 @@ xml_handler_start_element(XMLParser *p, const char *name, size_t namelen) } else if(ctx.tagid == AtomTagAuthor) { ctx.field = &ctx.item.author; } - /* clear field */ - if(ctx.field) - string_clear(ctx.field); } + /* clear field */ + if(ctx.field) + string_clear(ctx.field); } static void