From 1c689217b143d16a824e818b2cfe942a934b30c2 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Mon, 5 Jan 2015 19:56:12 +0100 Subject: remove some TODOs, style --- TODO | 7 +++---- sfeed.c | 17 ++++++++--------- sfeed_frames.c | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/TODO b/TODO index 95467b4..7de0d39 100644 --- 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 index 3d5e1a3..3bf179e 100644 --- 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, "