[libxml2] Stop counting nbChars in parser context
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Stop counting nbChars in parser context
- Date: Sun, 9 Aug 2020 13:02:23 +0000 (UTC)
commit 438e595a8cccbe48de3a0be2e0c291cfe97080b1
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Sun Aug 9 14:43:53 2020 +0200
Stop counting nbChars in parser context
The value was inaccurate and never used.
HTMLparser.c | 8 ++------
include/libxml/parser.h | 2 +-
parser.c | 9 +--------
parserInternals.c | 6 ------
4 files changed, 4 insertions(+), 21 deletions(-)
---
diff --git a/HTMLparser.c b/HTMLparser.c
index 541dcb5c7..de624f8d0 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -296,7 +296,7 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt)
#define UPPER (toupper(*ctxt->input->cur))
-#define SKIP(val) ctxt->nbChars += (val),ctxt->input->cur += (val),ctxt->input->col+=(val)
+#define SKIP(val) ctxt->input->cur += (val),ctxt->input->col+=(val)
#define NXT(val) ctxt->input->cur[(val)]
@@ -330,7 +330,7 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt)
if (*(ctxt->input->cur) == '\n') { \
ctxt->input->line++; ctxt->input->col = 1; \
} else ctxt->input->col++; \
- ctxt->token = 0; ctxt->input->cur += l; ctxt->nbChars++; \
+ ctxt->token = 0; ctxt->input->cur += l; \
} while (0)
/************
@@ -597,7 +597,6 @@ htmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
ctxt->input->line++; ctxt->input->col = 1;
} else ctxt->input->col++;
ctxt->input->cur++;
- ctxt->nbChars++;
if (*ctxt->input->cur == 0)
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
}
@@ -2495,7 +2494,6 @@ htmlParseName(htmlParserCtxtPtr ctxt) {
count = in - ctxt->input->cur;
ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count);
ctxt->input->cur = in;
- ctxt->nbChars += count;
ctxt->input->col += count;
return(ret);
}
@@ -4938,7 +4936,6 @@ htmlInitParserCtxt(htmlParserCtxtPtr ctxt)
ctxt->vctxt.warning = xmlParserValidityWarning;
ctxt->record_info = 0;
ctxt->validate = 0;
- ctxt->nbChars = 0;
ctxt->checkIndex = 0;
ctxt->catalogs = NULL;
xmlInitNodeInfoSeq(&ctxt->node_seq);
@@ -6581,7 +6578,6 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt)
ctxt->vctxt.error = xmlParserValidityError;
ctxt->vctxt.warning = xmlParserValidityWarning;
ctxt->record_info = 0;
- ctxt->nbChars = 0;
ctxt->checkIndex = 0;
ctxt->inSubset = 0;
ctxt->errNo = XML_ERR_OK;
diff --git a/include/libxml/parser.h b/include/libxml/parser.h
index 3020b20c5..1c86a97ce 100644
--- a/include/libxml/parser.h
+++ b/include/libxml/parser.h
@@ -231,7 +231,7 @@ struct _xmlParserCtxt {
int nameMax; /* Max depth of the parsing stack */
const xmlChar * *nameTab; /* array of nodes */
- long nbChars; /* number of xmlChar processed */
+ long nbChars; /* unused */
long checkIndex; /* used by progressive parsing lookup */
int keepBlanks; /* ugly but ... */
int disableSAX; /* SAX callbacks are disabled */
diff --git a/parser.c b/parser.c
index c66dbae47..e3d750eb1 100644
--- a/parser.c
+++ b/parser.c
@@ -2055,7 +2055,7 @@ static int spacePop(xmlParserCtxtPtr ctxt) {
((unsigned char *) s)[ 9 ] == c10 )
#define SKIP(val) do { \
- ctxt->nbChars += (val),ctxt->input->cur += (val),ctxt->input->col+=(val); \
+ ctxt->input->cur += (val),ctxt->input->col+=(val); \
if (*ctxt->input->cur == 0) \
xmlParserInputGrow(ctxt->input, INPUT_CHUNK); \
} while (0)
@@ -2066,7 +2066,6 @@ static int spacePop(xmlParserCtxtPtr ctxt) {
if (*(ctxt->input->cur) == '\n') { \
ctxt->input->line++; ctxt->input->col = 1; \
} else ctxt->input->col++; \
- ctxt->nbChars++; \
ctxt->input->cur++; \
} \
if (*ctxt->input->cur == 0) \
@@ -2119,7 +2118,6 @@ static void xmlGROW (xmlParserCtxtPtr ctxt) {
#define NEXT1 { \
ctxt->input->col++; \
ctxt->input->cur++; \
- ctxt->nbChars++; \
if (*ctxt->input->cur == 0) \
xmlParserInputGrow(ctxt->input, INPUT_CHUNK); \
}
@@ -2332,7 +2330,6 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) {
if (RAW == ';') {
/* on purpose to avoid reentrancy problems with NEXT and SKIP */
ctxt->input->col++;
- ctxt->nbChars ++;
ctxt->input->cur++;
}
} else if ((RAW == '&') && (NXT(1) == '#')) {
@@ -2361,7 +2358,6 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) {
if (RAW == ';') {
/* on purpose to avoid reentrancy problems with NEXT and SKIP */
ctxt->input->col++;
- ctxt->nbChars ++;
ctxt->input->cur++;
}
} else {
@@ -3333,7 +3329,6 @@ xmlParseName(xmlParserCtxtPtr ctxt) {
}
ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count);
ctxt->input->cur = in;
- ctxt->nbChars += count;
ctxt->input->col += count;
if (ret == NULL)
xmlErrMemory(ctxt, NULL);
@@ -3456,7 +3451,6 @@ xmlParseNCName(xmlParserCtxtPtr ctxt) {
}
ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count);
ctxt->input->cur = in;
- ctxt->nbChars += count;
ctxt->input->col += count;
if (ret == NULL) {
xmlErrMemory(ctxt, NULL);
@@ -14793,7 +14787,6 @@ xmlCtxtReset(xmlParserCtxtPtr ctxt)
ctxt->vctxt.warning = xmlParserValidityWarning;
#endif
ctxt->record_info = 0;
- ctxt->nbChars = 0;
ctxt->checkIndex = 0;
ctxt->inSubset = 0;
ctxt->errNo = XML_ERR_OK;
diff --git a/parserInternals.c b/parserInternals.c
index d849c08b6..b0629ef35 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -519,8 +519,6 @@ xmlNextChar(xmlParserCtxtPtr ctxt)
} else
/* 1-byte code */
ctxt->input->cur++;
-
- ctxt->nbChars++;
} else {
/*
* Assume it's a fixed length encoding (1) with
@@ -533,7 +531,6 @@ xmlNextChar(xmlParserCtxtPtr ctxt)
} else
ctxt->input->col++;
ctxt->input->cur++;
- ctxt->nbChars++;
}
if (*ctxt->input->cur == 0)
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
@@ -677,7 +674,6 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
}
if (*ctxt->input->cur == 0xD) {
if (ctxt->input->cur[1] == 0xA) {
- ctxt->nbChars++;
ctxt->input->cur++;
}
return(0xA);
@@ -693,7 +689,6 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
*len = 1;
if (*ctxt->input->cur == 0xD) {
if (ctxt->input->cur[1] == 0xA) {
- ctxt->nbChars++;
ctxt->input->cur++;
}
return(0xA);
@@ -1748,7 +1743,6 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
ctxt->options |= XML_PARSE_NOENT;
}
ctxt->record_info = 0;
- ctxt->nbChars = 0;
ctxt->checkIndex = 0;
ctxt->inSubset = 0;
ctxt->errNo = XML_ERR_OK;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]