1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

fixed where xmlMemoryDump() should be called. fixed handling of {0}, \n,

* testRegexp.c: fixed where xmlMemoryDump() should be called.
* xmlregexp.c: fixed handling of {0}, \n, \r and \t, two bugs
  affecting NIST regression tests
Daniel
This commit is contained in:
Daniel Veillard 2005-07-14 12:58:49 +00:00
parent 9202b674b5
commit 99c394d9c5
3 changed files with 39 additions and 4 deletions

View File

@ -1,3 +1,9 @@
Thu Jul 14 14:57:36 CEST 2005 Daniel Veillard <daniel@veillard.com>
* testRegexp.c: fixed where xmlMemoryDump() should be called.
* xmlregexp.c: fixed handling of {0}, \n, \r and \t, two bugs
affecting NIST regression tests
Thu Jul 14 11:30:24 CEST 2005 Daniel Veillard <daniel@veillard.com>
* configure.in: applied a patch from Gerrit P. Haase to add

View File

@ -140,12 +140,11 @@ int main(int argc, char **argv) {
}
}
}
xmlMemoryDump();
if (comp != NULL)
xmlRegFreeRegexp(comp);
}
xmlCleanupParser();
/* xmlMemoryDump(); */
xmlMemoryDump();
return(0);
}

View File

@ -1467,6 +1467,23 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
break;
}
return(0);
} else if ((atom->min == 0) && (atom->max == 0) &&
(atom->quant == XML_REGEXP_QUANT_RANGE)) {
/*
* we can discard the atom and generate an epsilon transition instead
*/
if (to == NULL) {
to = xmlRegNewState(ctxt);
if (to != NULL)
xmlRegStatePush(ctxt, to);
else {
return(-1);
}
}
xmlFAGenerateEpsilonTransition(ctxt, from, to);
ctxt->state = to;
xmlRegFreeAtom(atom);
return(0);
} else {
if (to == NULL) {
to = xmlRegNewState(ctxt);
@ -3815,8 +3832,21 @@ xmlFAParseCharClassEsc(xmlRegParserCtxtPtr ctxt) {
(cur == 0x5E)) {
if (ctxt->atom == NULL) {
ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_CHARVAL);
if (ctxt->atom != NULL)
ctxt->atom->codepoint = cur;
if (ctxt->atom != NULL) {
switch (cur) {
case 'n':
ctxt->atom->codepoint = '\n';
break;
case 'r':
ctxt->atom->codepoint = '\r';
break;
case 't':
ctxt->atom->codepoint = '\t';
break;
default:
ctxt->atom->codepoint = cur;
}
}
} else if (ctxt->atom->type == XML_REGEXP_RANGES) {
xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
XML_REGEXP_CHARVAL, cur, cur, NULL);