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

Completely changed the way the XPath evaluation is done, likely to break

stuff like libxslt right now:
- Makefile.am: detect XPath memleaks in regreson tests
- error.c: fixed and error w.r.t. error reporting still using
  stderr
- hash.c: added new line at end of file
- tree.h: minor cleanup
- xpath.[ch] xpointer.[ch]: Major changes ! Separated XPath
  expression parsing from evaluation, resulted in a number of
  changes internally, and in XPointer. Likely to break stuff
  using xpathInternals.h but should remain binary compatible,
  new interfaces will be added.
Daniel
This commit is contained in:
Daniel Veillard
2001-03-18 23:17:47 +00:00
parent 480363bdf5
commit 9e7160d45a
12 changed files with 1200 additions and 186 deletions

View File

@ -981,8 +981,8 @@ xmlXPtrEvalXPtrPart(xmlXPathParserContextPtr ctxt, xmlChar *name) {
const xmlChar *left = CUR_PTR;
CUR_PTR = buffer;
xmlXPathRoot(ctxt);
xmlXPathEvalExpr(ctxt);
xmlXPathRunEval(ctxt);
CUR_PTR=left;
#ifdef XPTR_XMLNS_SCHEME
} else if (xmlStrEqual(name, (xmlChar *) "xmlns")) {
@ -1174,6 +1174,20 @@ xmlXPtrEvalChildSeq(xmlXPathParserContextPtr ctxt, xmlChar *name) {
*/
void
xmlXPtrEvalXPointer(xmlXPathParserContextPtr ctxt) {
if (ctxt->valueTab == NULL) {
/* Allocate the value stack */
ctxt->valueTab = (xmlXPathObjectPtr *)
xmlMalloc(10 * sizeof(xmlXPathObjectPtr));
if (ctxt->valueTab == NULL) {
xmlFree(ctxt);
xmlGenericError(xmlGenericErrorContext,
"xmlXPathRunEval: out of memory\n");
return;
}
ctxt->valueNr = 0;
ctxt->valueMax = 10;
ctxt->value = NULL;
}
SKIP_BLANKS;
if (CUR == '/') {
xmlXPathRoot(ctxt);
@ -1279,12 +1293,6 @@ xmlXPtrEval(const xmlChar *str, xmlXPathContextPtr ctx) {
return(NULL);
ctxt = xmlXPathNewParserContext(str, ctx);
/* TAG:9999
if (ctx->node != NULL) {
init = xmlXPathNewNodeSet(ctx->node);
valuePush(ctxt, init);
}
*/
xmlXPtrEvalXPointer(ctxt);
if ((ctxt->value != NULL) &&