applied patch from Richard Jinks for the namespace axis + fixed a memory
* xpath.c: applied patch from Richard Jinks for the namespace
axis + fixed a memory error.
* parser.c parserInternals.c: applied patches from Peter Jacobi
removing ctxt->token for good.
* xmlschemas.c xmlschemastypes.c: fixed a few memory leaks
popped out by the regression tests.
* Makefile.am: patch for threads makefile from Gary Pennington
Daniel
diff --git a/xpath.c b/xpath.c
index 4d2fcd7..f824989 100644
--- a/xpath.c
+++ b/xpath.c
@@ -4873,7 +4873,7 @@
void
xmlXPathModValues(xmlXPathParserContextPtr ctxt) {
xmlXPathObjectPtr arg;
- double arg1, arg2, tmp;
+ double arg1, arg2;
arg = valuePop(ctxt);
if (arg == NULL)
@@ -4887,8 +4887,7 @@
if (arg2 == 0)
ctxt->value->floatval = xmlXPathNAN;
else {
- tmp=arg1/arg2;
- ctxt->value->floatval = arg2 * (tmp - (double)((int)tmp));
+ ctxt->value->floatval = fmod(arg1, arg2);
}
}
@@ -5443,26 +5442,28 @@
*/
xmlNodePtr
xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
- xmlNodePtr ret;
-
if (ctxt->context->node->type != XML_ELEMENT_NODE) return(NULL);
- if (cur == (xmlNodePtr) xmlXPathXMLNamespace)
- return(NULL);
- if ((cur == NULL) || (ctxt->context->tmpNsList == NULL)) {
+ if (ctxt->context->tmpNsList == NULL && cur != (xmlNodePtr) xmlXPathXMLNamespace) {
if (ctxt->context->tmpNsList != NULL)
xmlFree(ctxt->context->tmpNsList);
ctxt->context->tmpNsList =
xmlGetNsList(ctxt->context->doc, ctxt->context->node);
- if (ctxt->context->tmpNsList == NULL) return(NULL);
ctxt->context->tmpNsNr = 0;
- }
- ret = (xmlNodePtr)ctxt->context->tmpNsList[ctxt->context->tmpNsNr++];
- if (ret == NULL) {
- xmlFree(ctxt->context->tmpNsList);
- ctxt->context->tmpNsList = NULL;
+ if (ctxt->context->tmpNsList != NULL) {
+ while (ctxt->context->tmpNsList[ctxt->context->tmpNsNr] != NULL) {
+ ctxt->context->tmpNsNr++;
+ }
+ }
return((xmlNodePtr) xmlXPathXMLNamespace);
}
- return(ret);
+ if (ctxt->context->tmpNsNr > 0) {
+ return (xmlNodePtr)ctxt->context->tmpNsList[--ctxt->context->tmpNsNr];
+ } else {
+ if (ctxt->context->tmpNsList != NULL)
+ xmlFree(ctxt->context->tmpNsList);
+ ctxt->context->tmpNsList = NULL;
+ return(NULL);
+ }
}
/**