fixing a leak detected by testapi in xmlDOMWrapAdoptNode, and fixing

* testapi.c tree.c: fixing a leak detected by testapi in
  xmlDOMWrapAdoptNode, and fixing another side effect in testapi
  seems to pass tests fine now.
* include/libxml/parser.h parser.c: xmlStopParser() is no more limited
  to push mode
* error.c: remove a warning
* runtest.c xmllint.c: avoid compilation errors if only some parts
  of the library are compiled in.
Daniel
This commit is contained in:
Daniel Veillard 2005-07-03 22:48:50 +00:00
parent 7e33dbaa0e
commit 39e5c89016
9 changed files with 73 additions and 31 deletions

View File

@ -1,13 +1,18 @@
Mon Jul 4 00:39:35 CEST 2005 Daniel Veillard <daniel@veillard.com>
* gentest.py testapi.c: fix a problem with previous patch to
testapi.c
Sun Jul 3 23:42:31 CEST 2005 Daniel Veillard <daniel@veillard.com>
* testapi.c tree.c: fixing a leak detected by testapi in
xmlDOMWrapAdoptNode, and fixing another side effect in testapi
seems to pass tests fine now.
* include/libxml/parser.h parser.c: xmlStopParser() is no more limited
to push mode
* error.c: remove a warning
* runtest.c xmllint.c: avoid compilation errors if only some parts
of the library are compiled in.
Mon Jul 4 00:39:35 CEST 2005 Daniel Veillard <daniel@veillard.com>
* gentest.py testapi.c: fix a problem with previous patch to
testapi.c
Sun Jul 3 22:59:28 CEST 2005 Daniel Veillard <daniel@veillard.com>

View File

@ -127,7 +127,7 @@ AC_ARG_WITH(run_debug,
AC_ARG_WITH(sax1,
[ --with-sax1 add the older SAX1 interface (on)])
AC_ARG_WITH(schemas,
[ --with-schemas add Relax-NG and experimental Schemas support (on)])
[ --with-schemas add Relax-NG and Schemas support (on)])
AC_ARG_WITH(threads,
[ --with-threads add multithread support(on)])
AC_ARG_WITH(thread-alloc,
@ -155,6 +155,22 @@ AC_ARG_WITH(zlib,
fi
])
dnl
dnl hard dependancies on options
dnl
if test "$with_schemas" = "yes"
then
with_pattern=yes
with_regexp=yes
fi
if test "$with_reader" = "yes"
then
with_push=yes
fi
if test "$with_xptr" = "yes"
then
with_xpath=yes
fi
dnl
dnl option to build a minimal libxml2 library
dnl

View File

@ -514,7 +514,7 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
if ((node->doc != NULL) && (node->doc->URL != NULL)) {
baseptr = node;
file = node->doc->URL;
file = (const char *) node->doc->URL;
}
for (i = 0;
((i < 10) && (node != NULL) && (node->type != XML_ELEMENT_NODE));

View File

@ -836,10 +836,8 @@ XMLPUBFUN int XMLCALL
xmlSubstituteEntitiesDefault(int val);
XMLPUBFUN int XMLCALL
xmlKeepBlanksDefault (int val);
#ifdef LIBXML_PUSH_ENABLED
XMLPUBFUN void XMLCALL
xmlStopParser (xmlParserCtxtPtr ctxt);
#endif /* LIBXML_PUSH_ENABLED */
XMLPUBFUN int XMLCALL
xmlPedanticParserDefault(int val);
XMLPUBFUN int XMLCALL

View File

@ -10137,24 +10137,6 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
* *
************************************************************************/
/**
* xmlStopParser:
* @ctxt: an XML parser context
*
* Blocks further parser processing
*/
void
xmlStopParser(xmlParserCtxtPtr ctxt) {
if (ctxt == NULL)
return;
ctxt->instate = XML_PARSER_EOF;
ctxt->disableSAX = 1;
if (ctxt->input != NULL) {
ctxt->input->cur = BAD_CAST"";
ctxt->input->base = ctxt->input->cur;
}
}
/**
* xmlCreatePushParserCtxt:
* @sax: a SAX handler
@ -10287,6 +10269,24 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
}
#endif /* LIBXML_PUSH_ENABLED */
/**
* xmlStopParser:
* @ctxt: an XML parser context
*
* Blocks further parser processing
*/
void
xmlStopParser(xmlParserCtxtPtr ctxt) {
if (ctxt == NULL)
return;
ctxt->instate = XML_PARSER_EOF;
ctxt->disableSAX = 1;
if (ctxt->input != NULL) {
ctxt->input->cur = BAD_CAST"";
ctxt->input->base = ctxt->input->cur;
}
}
/**
* xmlCreateIOParserCtxt:
* @sax: a SAX handler

View File

@ -2122,6 +2122,7 @@ streamMemParseTest(const char *filename, const char *result, const char *err,
#endif
#ifdef LIBXML_XPATH_ENABLED
#ifdef LIBXML_DEBUG_ENABLED
/************************************************************************
* *
* XPath and XPointer based tests *
@ -2411,6 +2412,7 @@ xmlidDocTest(const char *filename,
return(res);
}
#endif /* LIBXML_DEBUG_ENABLED */
#endif /* XPATH */
/************************************************************************
* *
@ -2909,6 +2911,7 @@ rngTest(const char *filename,
return(res);
}
#ifdef LIBXML_READER_ENABLED
/**
* rngStreamTest:
* @filename: the schemas file
@ -2999,11 +3002,12 @@ rngStreamTest(const char *filename,
return(res);
}
#endif /* READER */
#endif
#ifdef LIBXML_PATTERN_ENABLED
#ifdef LIBXML_READER_ENABLED
/************************************************************************
* *
* Patterns tests *
@ -3212,7 +3216,8 @@ patternTest(const char *filename,
free(temp);
return(ret);
}
#endif
#endif /* READER */
#endif /* PATTERN */
#ifdef LIBXML_C14N_ENABLED
/************************************************************************
* *
@ -3890,6 +3895,7 @@ testDesc testDescriptions[] = {
NULL, XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE },
#endif
#ifdef LIBXML_XPATH_ENABLED
#ifdef LIBXML_DEBUG_ENABLED
{ "XPath expressions regression tests" ,
xpathExprTest, "./test/XPath/expr/*", "result/XPath/expr/", "", NULL,
0 },
@ -3904,6 +3910,7 @@ testDesc testDescriptions[] = {
{ "xml:id regression tests" ,
xmlidDocTest, "./test/xmlid/*", "result/xmlid/", "", ".err",
0 },
#endif
#endif
{ "URI parsing tests" ,
uriParseTest, "./test/URI/*.uri", "result/URI/", "", NULL,
@ -3918,15 +3925,19 @@ testDesc testDescriptions[] = {
{ "Relax-NG regression tests" ,
rngTest, "./test/relaxng/*.rng", NULL, NULL, NULL,
XML_PARSE_DTDATTR | XML_PARSE_NOENT },
#ifdef LIBXML_READER_ENABLED
{ "Relax-NG streaming regression tests" ,
rngStreamTest, "./test/relaxng/*.rng", NULL, NULL, NULL,
XML_PARSE_DTDATTR | XML_PARSE_NOENT },
#endif
#endif
#ifdef LIBXML_PATTERN_ENABLED
#ifdef LIBXML_READER_ENABLED
{ "Pattern regression tests" ,
patternTest, "./test/pattern/*.pat", "result/pattern/", NULL, NULL,
0 },
#endif
#endif
#ifdef LIBXML_C14N_ENABLED
{ "C14N with comments regression tests" ,
c14nWithCommentTest, "./test/c14n/with-comments/*.xml", NULL, NULL, NULL,

2
tree.c
View File

@ -7445,7 +7445,7 @@ xmlDOMWrapNSNormGatherInScopeNs(xmlNsMapItemPtr *map,
str = xmlDictLookup(destDoc->dict, str, -1); \
if ((sourceDoc == NULL) || (sourceDoc->dict == NULL) || \
(!xmlDictOwns(sourceDoc->dict, old))) \
xmlFree(old); \
xmlFree((char *)old); \
} else if ((sourceDoc) && (sourceDoc->dict) && \
xmlDictOwns(sourceDoc->dict, str)) { \
str = BAD_CAST xmlStrdup(str); \

View File

@ -2341,7 +2341,11 @@ main(int argc, char **argv) {
}
#endif /* LIBXML_SCHEMAS_ENABLED */
#ifdef LIBXML_PATTERN_ENABLED
if ((pattern != NULL) && (walker == 0)) {
if ((pattern != NULL)
#ifdef LIBXML_WALKER_ENABLED
&& (walker == 0)
#endif
) {
patternc = xmlPatterncompile((const xmlChar *) pattern, NULL, 0, NULL);
if (patternc == NULL) {
xmlGenericError(xmlGenericErrorContext,

View File

@ -664,7 +664,9 @@ struct _xmlSchemaValidCtxt {
xmlDictPtr dict;
#ifdef LIBXML_READER_ENABLED
xmlTextReaderPtr reader;
#endif
xmlSchemaAttrInfoPtr *attrInfos;
int nbAttrInfos;
@ -18330,6 +18332,7 @@ xmlSchemaLookupNamespace(xmlSchemaValidCtxtPtr vctxt,
}
}
return (NULL);
#ifdef LIBXML_WRITER_ENABLED
} else if (vctxt->reader != NULL) {
xmlChar *nsName;
@ -18343,6 +18346,7 @@ xmlSchemaLookupNamespace(xmlSchemaValidCtxtPtr vctxt,
return (ret);
} else
return (NULL);
#endif
} else {
xmlNsPtr ns;
@ -23411,7 +23415,9 @@ xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt)
vctxt->flags = 0;
vctxt->validationRoot = NULL;
vctxt->doc = NULL;
#ifdef LIBXML_READER_ENABLED
vctxt->reader = NULL;
#endif
if (vctxt->value != NULL) {
xmlSchemaFreeValue(vctxt->value);
vctxt->value = NULL;
@ -23846,12 +23852,14 @@ xmlSchemaVStart(xmlSchemaValidCtxtPtr vctxt)
* Tree validation.
*/
ret = xmlSchemaVDocWalk(vctxt);
#ifdef LIBXML_READER_ENABLED
} else if (vctxt->reader != NULL) {
/*
* XML Reader validation.
*/
#ifdef XML_SCHEMA_READER_ENABLED
ret = xmlSchemaVReaderWalk(vctxt);
#endif
#endif
} else if ((vctxt->sax != NULL) && (vctxt->parserCtxt != NULL)) {
/*