summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2017-12-24 12:48:33 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2017-12-24 12:48:33 +0100
commit21ba6ab0544e688c3ef78cdefbadfa76ed729190 (patch)
tree1ae3f69f40de5b68e6f0073e075ec8f94ff2b89c
parenta720526f1b490bb84eb357ce4b4114e11ccca3ec (diff)
xml: make name entities static, minor clarifications
-rw-r--r--xml.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/xml.c b/xml.c
index 178b8ed..0e86d34 100644
--- a/xml.c
+++ b/xml.c
@@ -90,8 +90,7 @@ xml_parseattrs(XMLParser *x)
break;
}
}
- namelen = 0;
- endname = 0;
+ namelen = endname = 0;
} else if (namelen < sizeof(x->name) - 1) {
x->name[namelen++] = c;
}
@@ -221,7 +220,7 @@ xml_codepointtoutf8(uint32_t cp, uint32_t *utf)
ssize_t
xml_namedentitytostr(const char *e, char *buf, size_t bufsiz)
{
- const struct {
+ static const struct {
char *entity;
int c;
} entities[] = {
@@ -268,7 +267,7 @@ xml_numericentitytostr(const char *e, char *buf, size_t bufsiz)
return -1;
/* not a numeric entity */
- if (!(e[0] == '&' && e[1] == '#'))
+ if (e[0] != '&' || e[1] != '#')
return 0;
/* e[1] == '#', numeric / hexadecimal entity */