sfeed

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

commit 29fa81e623c0e8787fcdc7a6109c3a24b562564a
parent c4573f3289e429b939da0b5ac6d4a950ce72466a
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun, 16 Aug 2015 20:09:59 +0200

code-style + no need to zero static variables

Diffstat:
Msfeed_frames.c | 10++++------
Msfeed_html.c | 10+++++-----
Msfeed_mbox.c | 4++--
Msfeed_plain.c | 6+++---
Msfeed_web.c | 2+-
Msfeed_xmlenc.c | 6+++---
6 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/sfeed_frames.c b/sfeed_frames.c @@ -15,14 +15,12 @@ #include "util.h" -static char *line = NULL; -size_t linesize = 0; - +static struct feed **feeds; +static char *line; +static size_t linesize; static struct utimbuf contenttime; static time_t comparetime; -static unsigned long totalnew = 0; - -static struct feed **feeds = NULL; +static unsigned long totalnew; /* Unescape / decode fields printed by string_print_encoded() * "\\" to "\", "\t", to TAB, "\n" to newline. Unrecognised escape sequences diff --git a/sfeed_html.c b/sfeed_html.c @@ -7,11 +7,11 @@ #include "util.h" -static struct feed **feeds = NULL; -static int showsidebar = 0; /* show sidebar ? */ -static char *line = NULL; -static size_t linesize = 0; -static unsigned long totalnew = 0; +static struct feed **feeds; +static int showsidebar; +static char *line; +static size_t linesize; +static unsigned long totalnew; static time_t comparetime; static void diff --git a/sfeed_mbox.c b/sfeed_mbox.c @@ -12,8 +12,8 @@ #include "util.h" -static char *line = NULL; -static size_t linesize = 0; +static char *line; +static size_t linesize; /* jenkins one-at-a-time hash, used for Message-Id */ static uint32_t diff --git a/sfeed_plain.c b/sfeed_plain.c @@ -9,8 +9,8 @@ #include "util.h" static time_t comparetime; -static char *line = NULL; -static size_t size = 0; +static char *line; +static size_t linesize; /* print `len' columns of characters. If string is shorter pad the rest * with characters `pad`. */ @@ -41,7 +41,7 @@ printfeed(FILE *fp, const char *feedname) char *fields[FieldLast]; time_t parsedtime; - while (parseline(&line, &size, fields, fp) > 0) { + while (parseline(&line, &linesize, fields, fp) > 0) { parsedtime = 0; strtotime(fields[FieldUnixTimestamp], &parsedtime); diff --git a/sfeed_web.c b/sfeed_web.c @@ -81,7 +81,7 @@ xmlattr(XMLParser *p, const char *tag, size_t taglen, const char *name, isfeedlink = 1; strlcpy(feedtype, value, sizeof(feedtype)); } - } else if (!strncasecmp(name, "href", namelen)) { + } else if (!strcasecmp(name, "href")) { strlcpy(feedlink, value, sizeof(feedlink)); } } diff --git a/sfeed_xmlenc.c b/sfeed_xmlenc.c @@ -8,7 +8,7 @@ #include "xml.h" static XMLParser parser; -static int isxmlpi = 0, tags = 0; +static int isxmlpi, tags; static void xmltagstart(XMLParser *p, const char *tag, size_t taglen) @@ -42,7 +42,7 @@ xmlattr(XMLParser *p, const char *tag, size_t taglen, const char *name, (void)taglen; (void)valuelen; - if (isxmlpi && (!strncasecmp(name, "encoding", namelen))) { + if (isxmlpi && (!strcasecmp(name, "encoding"))) { if (*value) { /* output lowercase */ for (; *value; value++) @@ -57,8 +57,8 @@ int main(void) { parser.xmlattr = xmlattr; - parser.xmltagstart = xmltagstart; parser.xmltagend = xmltagend; + parser.xmltagstart = xmltagstart; xml_parse_fd(&parser, 0);