summaryrefslogtreecommitdiff
path: root/sfeed_opml_import.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2021-01-16 00:01:09 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2021-01-16 12:27:13 +0100
commit4c35fd89e81ee83b1174dd6cfed3d6beaf25dc63 (patch)
tree28ebef1573223932ae7da01deda1c94edb16cb17 /sfeed_opml_import.c
parent3260b503e5a4c1d4ccabed0b2672e2f49c38df05 (diff)
sfeed_opml_import: minor code-style improvements
Diffstat (limited to 'sfeed_opml_import.c')
-rw-r--r--sfeed_opml_import.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/sfeed_opml_import.c b/sfeed_opml_import.c
index 47cc1ab..6eef0ca 100644
--- a/sfeed_opml_import.c
+++ b/sfeed_opml_import.c
@@ -7,7 +7,7 @@
#include "xml.h"
static XMLParser parser; /* XML parser state */
-static char url[2048], text[256], title[256];
+static char text[256], title[256], xmlurl[2048];
static void
printsafe(const char *s)
@@ -27,7 +27,7 @@ printsafe(const char *s)
static void
xmltagstart(XMLParser *p, const char *t, size_t tl)
{
- url[0] = text[0] = title[0] = '\0';
+ text[0] = title[0] = xmlurl[0] = '\0';
}
static void
@@ -36,8 +36,9 @@ xmltagend(XMLParser *p, const char *t, size_t tl, int isshort)
if (strcasecmp(t, "outline"))
return;
- if (url[0]) {
+ if (xmlurl[0]) {
fputs("\tfeed '", stdout);
+ /* prefer title over text attribute */
if (title[0])
printsafe(title);
else if (text[0])
@@ -45,11 +46,11 @@ xmltagend(XMLParser *p, const char *t, size_t tl, int isshort)
else
fputs("unnamed", stdout);
fputs("' '", stdout);
- printsafe(url);
+ printsafe(xmlurl);
fputs("'\n", stdout);
}
- url[0] = text[0] = title[0] = '\0';
+ text[0] = title[0] = xmlurl[0] = '\0';
}
static void
@@ -59,12 +60,12 @@ xmlattr(XMLParser *p, const char *t, size_t tl, const char *n, size_t nl,
if (strcasecmp(t, "outline"))
return;
- if (!strcasecmp(n, "title"))
- strlcat(title, v, sizeof(title));
- else if (!strcasecmp(n, "text"))
+ if (!strcasecmp(n, "text"))
strlcat(text, v, sizeof(text));
+ else if (!strcasecmp(n, "title"))
+ strlcat(title, v, sizeof(title));
else if (!strcasecmp(n, "xmlurl"))
- strlcat(url, v, sizeof(url));
+ strlcat(xmlurl, v, sizeof(xmlurl));
}
static void