From 29fa81e623c0e8787fcdc7a6109c3a24b562564a Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 16 Aug 2015 20:09:59 +0200 Subject: code-style + no need to zero static variables --- sfeed_frames.c | 10 ++++------ sfeed_html.c | 10 +++++----- sfeed_mbox.c | 4 ++-- sfeed_plain.c | 6 +++--- sfeed_web.c | 2 +- sfeed_xmlenc.c | 6 +++--- 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/sfeed_frames.c b/sfeed_frames.c index 302dd13..28bfa61 100644 --- 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 index 2f729d7..63e6ca6 100644 --- 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 index 330c90c..743d23c 100644 --- 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 index 23cb868..64c2b68 100644 --- 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 index f9f76b5..4ecbf0d 100644 --- 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 index 222c31a..494d840 100644 --- 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); -- cgit v1.2.3