summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfeed.c35
-rw-r--r--sfeed_xmlenc.c2
2 files changed, 19 insertions, 18 deletions
diff --git a/sfeed.c b/sfeed.c
index 8b8e0d8..9effd14 100644
--- a/sfeed.c
+++ b/sfeed.c
@@ -103,23 +103,24 @@ gettag(int feedtype, const char *name, size_t namelen) {
};
int i, n;
- if(namelen >= 2 && namelen <= 15) {
- if(feedtype == FeedTypeRSS) {
- for(i = 0; rsstag[i].name; i++) {
- if(!(n = strncasecmp(rsstag[i].name, name, rsstag[i].namelen)))
- return rsstag[i].id;
- /* optimization: it's sorted so nothing after it matches. */
- if(n > 0)
- return TagUnknown;
- }
- } else if(feedtype == FeedTypeAtom) {
- for(i = 0; atomtag[i].name; i++) {
- if(!(n = strncasecmp(atomtag[i].name, name, atomtag[i].namelen)))
- return atomtag[i].id;
- /* optimization: it's sorted so nothing after it matches. */
- if(n > 0)
- return TagUnknown;
- }
+ if(namelen < 2 || namelen > 15) /* optimization */
+ return TagUnknown;
+
+ if(feedtype == FeedTypeRSS) {
+ for(i = 0; rsstag[i].name; i++) {
+ if(!(n = strncasecmp(rsstag[i].name, name, rsstag[i].namelen)))
+ return rsstag[i].id;
+ /* optimization: it's sorted so nothing after it matches. */
+ if(n > 0)
+ return TagUnknown;
+ }
+ } else if(feedtype == FeedTypeAtom) {
+ for(i = 0; atomtag[i].name; i++) {
+ if(!(n = strncasecmp(atomtag[i].name, name, atomtag[i].namelen)))
+ return atomtag[i].id;
+ /* optimization: it's sorted so nothing after it matches. */
+ if(n > 0)
+ return TagUnknown;
}
}
return TagUnknown;
diff --git a/sfeed_xmlenc.c b/sfeed_xmlenc.c
index 97c1c2b..b760a18 100644
--- a/sfeed_xmlenc.c
+++ b/sfeed_xmlenc.c
@@ -12,7 +12,7 @@ static void
xmltagstart(XMLParser *p, const char *tag, size_t taglen) {
if(tags > 3) /* optimization: try to find processing instruction at start */
exit(EXIT_FAILURE);
- isxmlpi = (tag[0] == '?' && (!strncasecmp(tag, "?xml", taglen))) ? 1 : 0;
+ isxmlpi = (!strncasecmp(tag, "?xml", taglen)) ? 1 : 0;
tags++;
}