From 4c35fd89e81ee83b1174dd6cfed3d6beaf25dc63 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sat, 16 Jan 2021 00:01:09 +0100 Subject: sfeed_opml_import: minor code-style improvements --- sfeed_opml_import.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'sfeed_opml_import.c') 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 -- cgit v1.2.3