+Wed Jan 14 14:28:02 HKT 2004 William Brack <wbrack@mmm.com.hk>
+
+ * libexslt/math.c, libexslt/common.c: fixed problem,
+ reported on the list by Markus Bayerlein, concerning
+ math functions on nodesets generated with
+ exslt:node-set
+ * tests/exslt/math/max.3.xsl, tests/exslt/math/max.3.xml,
+ tests/exslt/math/max.3.out, tests/exslt/math/Makefile.am:
+ added test case for above.
+
Tue Jan 13 00:33:50 HKT 2004 William Brack <wbrack@mmm.com.hk>
* libxslt/transform.c: changed to assure comment which
exsltMathMinFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlNodeSetPtr ns;
double ret;
+ void *user = NULL;
if (nargs != 1) {
xsltGenericError(xsltGenericErrorContext,
ctxt->error = XPATH_INVALID_ARITY;
return;
}
+ /* We need to delay the freeing of value->user */
+ if ((ctxt->value != NULL) && (ctxt->value->boolval != 0)) {
+ user = ctxt->value->user;
+ ctxt->value->boolval = 0;
+ ctxt->value->user = NULL;
+ }
ns = xmlXPathPopNodeSet(ctxt);
if (xmlXPathCheckError(ctxt))
return;
ret = exsltMathMin(ns);
xmlXPathFreeNodeSet(ns);
+ if (user != NULL)
+ xmlFreeNodeList((xmlNodePtr)user);
xmlXPathReturnNumber(ctxt, ret);
}
exsltMathMaxFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlNodeSetPtr ns;
double ret;
+ void *user = NULL;
if (nargs != 1) {
xmlXPathSetArityError(ctxt);
return;
}
+
+ /* We need to delay the freeing of value->user */
+ if ((ctxt->value != NULL) && (ctxt->value->boolval != 0)) {
+ user = ctxt->value->user;
+ ctxt->value->boolval = 0;
+ ctxt->value->user = 0;
+ }
ns = xmlXPathPopNodeSet(ctxt);
if (xmlXPathCheckError(ctxt))
return;
xmlXPathFreeNodeSet(ns);
+ if (user != NULL)
+ xmlFreeNodeList((xmlNodePtr)user);
xmlXPathReturnNumber(ctxt, ret);
}
static void
exsltMathHighestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlNodeSetPtr ns, ret;
+ void *user = NULL;
if (nargs != 1) {
xmlXPathSetArityError(ctxt);
return;
}
+ /* We need to delay the freeing of value->user */
+ if ((ctxt->value != NULL) && ctxt->value->boolval != 0) {
+ user = ctxt->value->user;
+ ctxt->value->boolval = 0;
+ ctxt->value->user = NULL;
+ }
ns = xmlXPathPopNodeSet(ctxt);
if (xmlXPathCheckError(ctxt))
return;
ret = exsltMathHighest(ns);
xmlXPathFreeNodeSet(ns);
+ if (user != NULL)
+ xmlFreeNodeList((xmlNodePtr)user);
xmlXPathReturnNodeSet(ctxt, ret);
}
static void
exsltMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlNodeSetPtr ns, ret;
+ void *user = NULL;
+
if (nargs != 1) {
xmlXPathSetArityError(ctxt);
return;
}
+ /* We need to delay the freeing of value->user */
+ if ((ctxt->value != NULL) && (ctxt->value->boolval != 0)) {
+ user = ctxt->value->user;
+ ctxt->value->boolval = 0;
+ ctxt->value->user = NULL;
+ }
ns = xmlXPathPopNodeSet(ctxt);
if (xmlXPathCheckError(ctxt))
return;
ret = exsltMathLowest(ns);
xmlXPathFreeNodeSet(ns);
+ if (user != NULL)
+ xmlFreeNodeList((xmlNodePtr)user);
xmlXPathReturnNodeSet(ctxt, ret);
}