Change enum names to all-caps

This commit is contained in:
dogeystamp 2022-10-24 20:40:18 -04:00
parent 5d2ab702f9
commit 04eaae7230
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
2 changed files with 14 additions and 14 deletions

22
xml.c
View File

@ -62,17 +62,17 @@ parseXml(xmlDocPtr doc,
return 1; return 1;
} }
enum feedFormat format = none; enum feedFormat format = NONE;
if (TAGIS(rootNode, "rss")) { if (TAGIS(rootNode, "rss")) {
format = rss; format = RSS;
} else if (TAGIS(rootNode, "feed")) { } else if (TAGIS(rootNode, "feed")) {
if (!xmlStrcmp(rootNode->ns->href, (const xmlChar *) "http://www.w3.org/2005/Atom")) if (!xmlStrcmp(rootNode->ns->href, (const xmlChar *) "http://www.w3.org/2005/Atom"))
format = atom; format = ATOM;
} }
if (format == none) { if (format == NONE) {
logMsg(1, "XML document is not an RSS or Atom feed.\n"); logMsg(1, "XML document is not an RSS or Atom feed.\n");
return 1; return 1;
} }
@ -81,7 +81,7 @@ parseXml(xmlDocPtr doc,
xmlNodePtr cur = rootNode->children; xmlNodePtr cur = rootNode->children;
switch (format) { switch (format) {
case rss: case RSS:
// Get channel XML tag // Get channel XML tag
while(cur && !TAGIS(cur, "channel")) while(cur && !TAGIS(cur, "channel"))
cur = cur->next; cur = cur->next;
@ -95,7 +95,7 @@ parseXml(xmlDocPtr doc,
cur = cur->children; cur = cur->children;
break; break;
case atom: case ATOM:
// Set cur to child of feed // Set cur to child of feed
cur = rootNode->children; cur = rootNode->children;
break; break;
@ -114,10 +114,10 @@ parseXml(xmlDocPtr doc,
short isArticle = 0; short isArticle = 0;
switch (format) { switch (format) {
case rss: case RSS:
isArticle = TAGIS(cur, "item"); isArticle = TAGIS(cur, "item");
break; break;
case atom: case ATOM:
isArticle = TAGIS(cur, "entry"); isArticle = TAGIS(cur, "entry");
break; break;
default: default:
@ -154,11 +154,11 @@ parseXml(xmlDocPtr doc,
}; };
switch (format) { switch (format) {
case rss: case RSS:
attKeys = attKeysRss; attKeys = attKeysRss;
break; break;
case atom: case ATOM:
attKeys = attKeysAtom; attKeys = attKeysAtom;
break; break;
@ -196,7 +196,7 @@ parseXml(xmlDocPtr doc,
// Exceptions // Exceptions
// Atom entry link tag // Atom entry link tag
if (format == atom && TAGIS(itemNode, "link")) { if (format == ATOM && TAGIS(itemNode, "link")) {
xmlChar *link = xmlGetProp(itemNode, (xmlChar *) "href"); xmlChar *link = xmlGetProp(itemNode, (xmlChar *) "href");
if (!link) { if (!link) {

6
xml.h
View File

@ -18,9 +18,9 @@ struct itemStruct {
}; };
enum feedFormat { enum feedFormat {
none, NONE,
rss, RSS,
atom ATOM,
}; };
void freeItem(itemStruct *item); void freeItem(itemStruct *item);