1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

- xpath.c tree.c parser.c: speed optimizations at the parser level

document tree freeing and xpath evaluation
Daniel
This commit is contained in:
Daniel Veillard
2001-05-16 21:05:17 +00:00
parent fd7ddca8b2
commit 76d66f416d
4 changed files with 57 additions and 29 deletions

13
xpath.c
View File

@ -1926,7 +1926,7 @@ xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt) {
if (ctxt == NULL)
return;
xmlHashFree(ctxt->varHash, NULL);
xmlHashFree(ctxt->varHash, (xmlHashDeallocator)xmlXPathFreeObject);
ctxt->varHash = NULL;
}
@ -5603,9 +5603,10 @@ xmlXPathParseName(xmlXPathParserContextPtr ctxt) {
while (((*in >= 0x61) && (*in <= 0x7A)) ||
((*in >= 0x41) && (*in <= 0x5A)) ||
((*in >= 0x30) && (*in <= 0x39)) ||
(*in == '_') || (*in == ':'))
(*in == '_') || (*in == '-') ||
(*in == ':') || (*in == '.'))
in++;
if ((*in == ' ') || (*in == '>') || (*in == '/')) {
if ((*in > 0) && (*in < 0x80)) {
count = in - ctxt->cur;
ret = xmlStrndup(ctxt->cur, count);
ctxt->cur = in;
@ -7452,7 +7453,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) {
case XPATH_OP_AND:
xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
xmlXPathBooleanFunction(ctxt, 1);
if (ctxt->value->boolval == 0)
if ((ctxt->value == NULL) || (ctxt->value->boolval == 0))
return;
arg2 = valuePop(ctxt);
xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
@ -7465,7 +7466,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) {
case XPATH_OP_OR:
xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
xmlXPathBooleanFunction(ctxt, 1);
if (ctxt->value->boolval == 1)
if ((ctxt->value == NULL) || (ctxt->value->boolval == 1))
return;
arg2 = valuePop(ctxt);
xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
@ -7624,6 +7625,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) {
xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
if (op->ch2 == -1)
return;
if (ctxt->value == NULL)
return;
oldnode = ctxt->context->node;