summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2020-09-19 16:38:21 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2020-10-09 11:27:06 +0200
commit95f025d9bcc4b3d1e09a5790bb9ee2cb89ad4cf1 (patch)
tree2cd71da0d06cbe62ce3a0f6c363dc7a3c76a4748
parent88208d5ffda5cfbf03901038b41afae703f0d172 (diff)
xml.c: remove buffering of comment data, which is unused anyway
-rw-r--r--xml.c34
-rw-r--r--xml.h3
2 files changed, 2 insertions, 35 deletions
diff --git a/xml.c b/xml.c
index 29681a4..67ad5a8 100644
--- a/xml.c
+++ b/xml.c
@@ -116,49 +116,19 @@ startvalue:
static void
xml_parsecomment(XMLParser *x)
{
- size_t datalen = 0, i = 0;
+ size_t i = 0;
int c;
- if (x->xmlcommentstart)
- x->xmlcommentstart(x);
while ((c = GETNEXT()) != EOF) {
- if (c == '-' || c == '>') {
- if (x->xmlcomment && datalen) {
- x->data[datalen] = '\0';
- x->xmlcomment(x, x->data, datalen);
- datalen = 0;
- }
- }
-
if (c == '-') {
- if (++i > 2) {
- if (x->xmlcomment)
- for (; i > 2; i--)
- x->xmlcomment(x, "-", 1);
+ if (++i > 2)
i = 2;
- }
continue;
} else if (c == '>' && i == 2) {
- if (x->xmlcommentend)
- x->xmlcommentend(x);
return;
} else if (i) {
- if (x->xmlcomment) {
- for (; i > 0; i--)
- x->xmlcomment(x, "-", 1);
- }
i = 0;
}
-
- if (datalen < sizeof(x->data) - 1) {
- x->data[datalen++] = c;
- } else {
- x->data[datalen] = '\0';
- if (x->xmlcomment)
- x->xmlcomment(x, x->data, datalen);
- x->data[0] = c;
- datalen = 1;
- }
}
}
diff --git a/xml.h b/xml.h
index 00aae86..7b361d9 100644
--- a/xml.h
+++ b/xml.h
@@ -16,9 +16,6 @@ typedef struct xmlparser {
void (*xmlcdatastart)(struct xmlparser *);
void (*xmlcdata)(struct xmlparser *, const char *, size_t);
void (*xmlcdataend)(struct xmlparser *);
- void (*xmlcommentstart)(struct xmlparser *);
- void (*xmlcomment)(struct xmlparser *, const char *, size_t);
- void (*xmlcommentend)(struct xmlparser *);
void (*xmldata)(struct xmlparser *, const char *, size_t);
void (*xmldataend)(struct xmlparser *);
void (*xmldataentity)(struct xmlparser *, const char *, size_t);