sfeed

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

commit 1c689217b143d16a824e818b2cfe942a934b30c2
parent 1f75e9bc3f49ada6ebdbe9812a8dc92cb75b8afa
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Mon,  5 Jan 2015 19:56:12 +0100

remove some TODOs, style

Diffstat:
MTODO | 7+++----
Msfeed.c | 17++++++++---------
Msfeed_frames.c | 2+-
3 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/TODO b/TODO @@ -1,10 +1,9 @@ +[ ] grep -H -n *.c 'TODO:' +[ ] rewrite xml.{c,h} [ ] check truncation (strlcpy, snprintf etc), especially for paths. [x] fix timezone in slashdot.xml [x] string_append: make sure some fields can only be set once (first field counts?). [ ] test new parsetime and gettimetz code. -[ ] grep -H -n *.c 'TODO:' -[ ] sfeed.c: document ctx.iscontent and ctx.iscontenttag. -[ ] rewrite xml.{c,h} [ ] xml: check read errors: ferror, return code of fread, fwrite, fclose... [ ] separate codepointtoutf8 and entity handling from sfeed.c into xml.c? @@ -17,8 +16,8 @@ [ ] sfeed_opml_export [ ] feeds file: empty tab (encoding can't be detected?) [ ] optimize + [ ] benchmark / profile callstack. [ ] gettag() lookup. [ ] namedentitytostr lookup. [ ] xml parser, etc. [?] add sfeed_atom ? to aggregate feeds? - diff --git a/sfeed.c b/sfeed.c @@ -674,7 +674,8 @@ xml_handler_data_entity(XMLParser *p, const char *data, size_t datalen) char buffer[16]; size_t len; - /* try to translate entity, else just pass as data */ + /* try to translate entity, else just pass as data to + * xml_data_handler */ if((len = entitytostr(data, buffer, sizeof(buffer))) > 0) xml_handler_data(p, buffer, len); else @@ -688,22 +689,21 @@ xml_handler_end_element(XMLParser *p, const char *name, size_t namelen, int issh if(ctx.iscontent) { ctx.attrcount = 0; - /* TODO: optimize */ tagid = gettag(ctx.item.feedtype, name, namelen); - if(ctx.tagid == tagid) { /* close content */ + /* close content */ + if(ctx.tagid == tagid) { ctx.iscontent = 0; ctx.iscontenttag = 0; + ctx.tag[0] = '\0'; + ctx.taglen = 0; + ctx.tagid = TagUnknown; p->xmldataentity = xml_handler_data_entity; p->xmlattrstart = NULL; p->xmlattrend = NULL; p->xmltagstartparsed = NULL; - ctx.tag[0] = '\0'; /* unset tag */ - ctx.taglen = 0; - ctx.tagid = TagUnknown; - - return; /* TODO: not sure if !isshort check below should be skipped */ + return; } if(!isshort) { xml_handler_data(p, "</", 2); @@ -715,7 +715,6 @@ xml_handler_end_element(XMLParser *p, const char *name, size_t namelen, int issh if(ctx.item.feedtype == FeedTypeNone) return; /* end of RSS or Atom entry / item */ - /* TODO: optimize, use gettag() ? to tagid? */ if((ctx.item.feedtype == FeedTypeAtom && istag(name, namelen, STRP("entry"))) || /* Atom */ (ctx.item.feedtype == FeedTypeRSS && diff --git a/sfeed_frames.c b/sfeed_frames.c @@ -140,7 +140,7 @@ main(int argc, char *argv[]) { struct feed *f, *fcur = NULL; char *fields[FieldLast]; - char name[64]; /* TODO: bigger size? */ + char name[256]; /* buffer for feedname */ char dirpath[PATH_MAX], filepath[PATH_MAX]; char reldirpath[PATH_MAX], relfilepath[PATH_MAX]; char *feedname = "", *basepath = ".";