summaryrefslogtreecommitdiff
path: root/sfeed_web.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-08-16 19:31:46 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-08-16 19:31:46 +0200
commit3946a701c0d409dd235f2bcb564b5701beb7d775 (patch)
tree1b9a3cc10ac6a269d81be4d543cd13201ae46949 /sfeed_web.c
parent42a1ceb58acc58ade796fa66eeed4bd8fd5901ec (diff)
code-style, wrap some lines, etc
Diffstat (limited to 'sfeed_web.c')
-rw-r--r--sfeed_web.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sfeed_web.c b/sfeed_web.c
index 1a496ba..f9f76b5 100644
--- a/sfeed_web.c
+++ b/sfeed_web.c
@@ -9,6 +9,9 @@
#include "util.h"
#include "xml.h"
+/* string and size */
+#define STRP(s) s,sizeof(s)-1
+
static XMLParser parser;
static unsigned int isbase, islink, isfeedlink, found;
static char abslink[4096], feedlink[4096], basehref[4096], feedtype[256];
@@ -31,9 +34,9 @@ xmltagstart(XMLParser *p, const char *tag, size_t taglen)
if (taglen != 4) /* optimization */
return;
- if (!strncasecmp(tag, "base", taglen))
+ if (!strcasecmp(tag, "base"))
isbase = 1;
- else if (!strncasecmp(tag, "link", taglen))
+ else if (!strcasecmp(tag, "link"))
islink = 1;
}
@@ -68,13 +71,13 @@ xmlattr(XMLParser *p, const char *tag, size_t taglen, const char *name,
if (namelen != 4) /* optimization */
return;
if (isbase) {
- if (!strncasecmp(name, "href", namelen))
+ if (!strcasecmp(name, "href"))
strlcpy(basehref, value, sizeof(basehref));
} else if (islink) {
- if (!strncasecmp(name, "type", namelen)) {
- if (!strncasecmp(value, "application/atom", strlen("application/atom")) ||
- !strncasecmp(value, "application/xml", strlen("application/xml")) ||
- !strncasecmp(value, "application/rss", strlen("application/rss"))) {
+ if (!strcasecmp(name, "type")) {
+ if (!strncasecmp(value, STRP("application/atom")) ||
+ !strncasecmp(value, STRP("application/xml")) ||
+ !strncasecmp(value, STRP("application/rss"))) {
isfeedlink = 1;
strlcpy(feedtype, value, sizeof(feedtype));
}