summaryrefslogtreecommitdiff
path: root/sfeed_web.c
diff options
context:
space:
mode:
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));
}