From a03e36566be477c034d30ba78c2524c55c41bc71 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Tue, 2 Nov 2004 18:45:30 +0000 Subject: [PATCH] more developments on the API testing more cleanups rebuilt Daniel * gentest.py testapi.c: more developments on the API testing * HTMLparser.c tree.c: more cleanups * doc/*: rebuilt Daniel --- ChangeLog | 6 + HTMLparser.c | 68 +- doc/APIchunk10.html | 1 + doc/APIchunk12.html | 2 + doc/APIchunk13.html | 4 + doc/APIchunk15.html | 21 - doc/APIchunk21.html | 3 +- doc/APIchunk26.html | 2 + doc/APIchunk5.html | 1 + doc/APIchunk6.html | 4 +- doc/APIchunk8.html | 1 + doc/APIchunk9.html | 1 + doc/APIfiles.html | 5 +- doc/APIsymbols.html | 3 + doc/html/libxml-valid.html | 6 +- doc/html/libxml-xmlmemory.html | 5 +- doc/libxml2-api.xml | 15 +- doc/libxml2-refs.xml | 53 +- gentest.py | 90 ++- testapi.c | 1389 +++++++++++++++++++++++++++----- tree.c | 5 +- 21 files changed, 1405 insertions(+), 280 deletions(-) diff --git a/ChangeLog b/ChangeLog index 491d988e..12ed45d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Nov 2 19:44:32 CET 2004 Daniel Veillard + + * gentest.py testapi.c: more developments on the API testing + * HTMLparser.c tree.c: more cleanups + * doc/*: rebuilt + Tue Nov 2 15:49:34 CET 2004 Daniel Veillard * xmlmemory.c include/libxml/xmlmemory.h: adding xmlMemBlocks() diff --git a/HTMLparser.c b/HTMLparser.c index 6022ed53..3fe4b5de 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -109,13 +109,15 @@ htmlParseErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, if ((ctxt != NULL) && (ctxt->disableSAX != 0) && (ctxt->instate == XML_PARSER_EOF)) return; - ctxt->errNo = error; + if (ctxt != NULL) + ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_HTML, error, XML_ERR_ERROR, NULL, 0, (const char *) str1, (const char *) str2, NULL, 0, 0, msg, str1, str2); - ctxt->wellFormed = 0; + if (ctxt != NULL) + ctxt->wellFormed = 0; } /** @@ -134,11 +136,13 @@ htmlParseErrInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, if ((ctxt != NULL) && (ctxt->disableSAX != 0) && (ctxt->instate == XML_PARSER_EOF)) return; - ctxt->errNo = error; + if (ctxt != NULL) + ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_HTML, error, XML_ERR_ERROR, NULL, 0, NULL, NULL, NULL, val, 0, msg, val); - ctxt->wellFormed = 0; + if (ctxt != NULL) + ctxt->wellFormed = 0; } /************************************************************************ @@ -394,13 +398,15 @@ encoding_error: * to ISO-Latin-1 (if you don't like this policy, just declare the * encoding !) */ - htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, - "Input is not proper UTF-8, indicate encoding !\n", - NULL, NULL); - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) { - ctxt->sax->error(ctxt->userData, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", + { + char buffer[150]; + + snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", ctxt->input->cur[0], ctxt->input->cur[1], ctxt->input->cur[2], ctxt->input->cur[3]); + htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, + "Input is not proper UTF-8, indicate encoding !\n", + BAD_CAST buffer, NULL); } ctxt->charset = XML_CHAR_ENCODING_8859_1; @@ -3018,6 +3024,12 @@ int htmlParseCharRef(htmlParserCtxtPtr ctxt) { int val = 0; + if ((ctxt == NULL) || (ctxt->input == NULL)) { + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "htmlParseCharRef: context error\n", + NULL, NULL); + return(0); + } if ((CUR == '&') && (NXT(1) == '#') && ((NXT(2) == 'x') || NXT(2) == 'X')) { SKIP(3); @@ -3341,6 +3353,11 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { int meta = 0; int i; + if ((ctxt == NULL) || (ctxt->input == NULL)) { + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "htmlParseStartTag: context error\n", NULL, NULL); + return; + } if (CUR != '<') return; NEXT; @@ -3822,9 +3839,15 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { const htmlElemDesc * info; htmlParserNodeInfo node_info; const xmlChar *oldname; - int depth = ctxt->nameNr; + int depth; const xmlChar *oldptr; + if ((ctxt == NULL) || (ctxt->input == NULL)) { + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "htmlParseStartTag: context error\n", NULL, NULL); + return; + } + depth = ctxt->nameNr; /* Capture start position */ if (ctxt->record_info) { node_info.begin_pos = ctxt->input->consumed + @@ -3947,8 +3970,13 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) { xmlInitParser(); htmlDefaultSAXHandlerInit(); - ctxt->html = 1; + if ((ctxt == NULL) || (ctxt->input == NULL)) { + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "htmlParseDocument: context error\n", NULL, NULL); + return(XML_ERR_INTERNAL_ERROR); + } + ctxt->html = 1; GROW; /* * SAX: beginning of the document processing. @@ -5132,6 +5160,11 @@ done: int htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size, int terminate) { + if ((ctxt == NULL) || (ctxt->input == NULL)) { + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "htmlParseChunk: context error\n", NULL, NULL); + return(XML_ERR_INTERNAL_ERROR); + } if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) && (ctxt->input->buf != NULL) && (ctxt->instate != XML_PARSER_EOF)) { int base = ctxt->input->base - ctxt->input->buf->buffer->content; @@ -5361,6 +5394,9 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding) /* htmlCharEncoding enc; */ xmlChar *content, *content_line = (xmlChar *) "charset="; + if (filename == NULL) + return(NULL); + ctxt = htmlNewParserCtxt(); if (ctxt == NULL) { return(NULL); @@ -5616,7 +5652,12 @@ void htmlCtxtReset(htmlParserCtxtPtr ctxt) { xmlParserInputPtr input; - xmlDictPtr dict = ctxt->dict; + xmlDictPtr dict; + + if (ctxt == NULL) + return; + + dict = ctxt->dict; while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */ xmlFreeInputStream(input); @@ -5696,6 +5737,9 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt) int htmlCtxtUseOptions(htmlParserCtxtPtr ctxt, int options) { + if (ctxt == NULL) + return(-1); + if (options & HTML_PARSE_NOWARNING) { ctxt->sax->warning = NULL; ctxt->vctxt.warning = NULL; diff --git a/doc/APIchunk10.html b/doc/APIchunk10.html index c5625ef6..a1079935 100644 --- a/doc/APIchunk10.html +++ b/doc/APIchunk10.html @@ -795,6 +795,7 @@ A:link, A:visited, A:active { text-decoration: underline }
cur
xmlXPathAxisFunc
currently
XML_SCHEMAS_INCLUDING_CONVERT_NS
xmlGcMemGet
+xmlMemBlocks
xmlMemGet
xmlMemUsed
xmlOutputBufferCreateFilename
diff --git a/doc/APIchunk12.html b/doc/APIchunk12.html index 030c8f7b..2e5756f3 100644 --- a/doc/APIchunk12.html +++ b/doc/APIchunk12.html @@ -100,6 +100,8 @@ A:link, A:visited, A:active { text-decoration: underline } isolat1ToUTF8
xmlCharEncodingInputFunc
xmlCharEncodingOutputFunc
+
embedded
XML_CTXT_FINISH_DTD_0
+XML_CTXT_FINISH_DTD_1
emitted
xmlSetGenericErrorFunc
empty-element
xmlParseStartTag
enable
xmlCatalogSetDebug
diff --git a/doc/APIchunk13.html b/doc/APIchunk13.html index 19d36a97..1f22598e 100644 --- a/doc/APIchunk13.html +++ b/doc/APIchunk13.html @@ -141,6 +141,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCreatePushParserCtxt
xmlUTF8Strpos
field
XML_COMPLETE_ATTRS
+XML_CTXT_FINISH_DTD_0
+XML_CTXT_FINISH_DTD_1
XML_DETECT_IDS
XML_SKIP_IDS
xmlParseMisc
@@ -182,6 +184,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNanoHTTPScanProxy
finds
xmlSearchNs
xmlSearchNsByHref
+
finishDtd
XML_CTXT_FINISH_DTD_0
+XML_CTXT_FINISH_DTD_1
finished
_xmlValidCtxt
xmlCleanupParser
xmlSkipBlankChars
diff --git a/doc/APIchunk15.html b/doc/APIchunk15.html index 31bb8f1f..41093c05 100644 --- a/doc/APIchunk15.html +++ b/doc/APIchunk15.html @@ -395,27 +395,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewPI
xmlSAX2ProcessingInstruction
insufficient
xmlCanonicPath
-
int
_xmlParserCtxt
-c
-getColumnNumber
-getLineNumber
-htmlHandleOmittedElem
-htmlParseCharRef
-xmlIsLetter
-xmlKeepBlanksDefault
-xmlLineNumbersDefault
-xmlMallocAtomicLoc
-xmlMallocLoc
-xmlMemUsed
-xmlParseCharData
-xmlParseCharRef
-xmlPedanticParserDefault
-xmlReallocLoc
-xmlSAX2GetColumnNumber
-xmlSAX2GetLineNumber
-xmlShellCmd
-xmlSplitQName3
-xmlSubstituteEntitiesDefault
integer
xmlStrcasecmp
xmlStrcmp
xmlStrncasecmp
diff --git a/doc/APIchunk21.html b/doc/APIchunk21.html index 13d61f54..e36896ac 100644 --- a/doc/APIchunk21.html +++ b/doc/APIchunk21.html @@ -399,7 +399,8 @@ A:link, A:visited, A:active { text-decoration: underline }
represented
xmlParseCharData
xmlXPathStringFunction
represented:
_htmlElemDesc
-
representing
xmlMemUsed
+
representing
xmlMemBlocks
+xmlMemUsed
request
xmlIOHTTPOpenW
xmlNanoHTTPMethod
xmlNanoHTTPMethodRedir
diff --git a/doc/APIchunk26.html b/doc/APIchunk26.html index bfde6d13..1f4f8d78 100644 --- a/doc/APIchunk26.html +++ b/doc/APIchunk26.html @@ -292,6 +292,8 @@ A:link, A:visited, A:active { text-decoration: underline }
xmlParseFile
xmlParseCatalogFile
xmlParseNamespace:
xmlParseNamespace
xmlParseURI
xmlURIEscape
+
xmlParserCtxt
XML_CTXT_FINISH_DTD_0
+XML_CTXT_FINISH_DTD_1
xmlParserCtxtPtr
xmlNewParserCtxt
xmlNewTextWriterPushParser
xmlParserError
_xmlError
diff --git a/doc/APIchunk5.html b/doc/APIchunk5.html index dbed0afd..d3cc136b 100644 --- a/doc/APIchunk5.html +++ b/doc/APIchunk5.html @@ -190,6 +190,7 @@ A:link, A:visited, A:active { text-decoration: underline }
Provides
getPublicId
getSystemId
xmlGcMemGet
+xmlMemBlocks
xmlMemGet
xmlMemUsed
xmlNanoHTTPContentLength
diff --git a/doc/APIchunk6.html b/doc/APIchunk6.html index a760e367..668cd2df 100644 --- a/doc/APIchunk6.html +++ b/doc/APIchunk6.html @@ -440,7 +440,9 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathNodeSetSort
SpacingModifierLetters
xmlUCSIsSpacingModifierLetters
Spec
xmlParseStartTag
-
Special
XML_SAX2_MAGIC
+
Special
XML_CTXT_FINISH_DTD_0
+XML_CTXT_FINISH_DTD_1
+XML_SAX2_MAGIC
Specials
xmlUCSIsSpecials
Speed
_xmlParserCtxt
Standalone
xmlParseSDDecl
diff --git a/doc/APIchunk8.html b/doc/APIchunk8.html index 443d4383..f13f5916 100644 --- a/doc/APIchunk8.html +++ b/doc/APIchunk8.html @@ -637,6 +637,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlReallocLoc
areas
xmlGcMemGet
xmlGcMemSetup
+xmlMemBlocks
xmlMemShow
args
CHECK_ARITY
x
diff --git a/doc/APIchunk9.html b/doc/APIchunk9.html index 7a056893..1a0c75b2 100644 --- a/doc/APIchunk9.html +++ b/doc/APIchunk9.html @@ -162,6 +162,7 @@ A:link, A:visited, A:active { text-decoration: underline } initdocbDefaultSAXHandler
inithtmlDefaultSAXHandler
initxmlDefaultSAXHandler
+xmlMemBlocks
xmlMemDisplay
xmlMemoryDump
book1
xmlBuildRelativeURI
diff --git a/doc/APIfiles.html b/doc/APIfiles.html index 3dc6559a..e6ac90c6 100644 --- a/doc/APIfiles.html +++ b/doc/APIfiles.html @@ -1433,7 +1433,9 @@ A:link, A:visited, A:active { text-decoration: underline } xmlURIEscapeStr
xmlURIPtr
xmlURIUnescapeString
-

Module valid:

_xmlValidCtxt
+

Module valid:

XML_CTXT_FINISH_DTD_0
+XML_CTXT_FINISH_DTD_1
+_xmlValidCtxt
xmlAddAttributeDecl
xmlAddElementDecl
xmlAddID
@@ -2407,6 +2409,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlMallocAtomicLoc
xmlMallocFunc
xmlMallocLoc
+xmlMemBlocks
xmlMemDisplay
xmlMemFree
xmlMemGet
diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html index 19a0caae..aff50ba2 100644 --- a/doc/APIsymbols.html +++ b/doc/APIsymbols.html @@ -223,6 +223,8 @@ A:link, A:visited, A:active { text-decoration: underline } XML_CHECK_X
XML_COMMENT_NODE
XML_COMPLETE_ATTRS
+XML_CTXT_FINISH_DTD_0
+XML_CTXT_FINISH_DTD_1
XML_DEFAULT_VERSION
XML_DETECT_IDS
XML_DOCB_DOCUMENT_NODE
@@ -2022,6 +2024,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlMallocAtomicLoc
xmlMallocFunc
xmlMallocLoc
+xmlMemBlocks
xmlMemDisplay
xmlMemFree
xmlMemGet
diff --git a/doc/html/libxml-valid.html b/doc/html/libxml-valid.html index bc180159..e26d1845 100644 --- a/doc/html/libxml-valid.html +++ b/doc/html/libxml-valid.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module valid from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module valid from libxml2

API Menu
API Indexes
Related links

API for the DTD handling and the validity checking

Table of Contents

Structure xmlAttributeTable
struct _xmlHashTable + Module valid from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module valid from libxml2

API Menu
API Indexes
Related links

API for the DTD handling and the validity checking

Table of Contents

#define XML_CTXT_FINISH_DTD_0
#define XML_CTXT_FINISH_DTD_1
Structure xmlAttributeTable
struct _xmlHashTable The content of this structure is not made public by the API.
Typedef xmlAttributeTable * xmlAttributeTablePtr
 
Structure xmlElementTable
struct _xmlHashTable @@ -104,6 +104,8 @@ void xmlValidityErrorFunc (void * ctx,
xmlValidityWarningFunc (void * ctx,
const char * msg,
... ...)

Description

+

Macro: XML_CTXT_FINISH_DTD_0

#define XML_CTXT_FINISH_DTD_0

Special value for finishDtd field when embedded in an xmlParserCtxt

+

Macro: XML_CTXT_FINISH_DTD_1

#define XML_CTXT_FINISH_DTD_1

Special value for finishDtd field when embedded in an xmlParserCtxt

Structure xmlAttributeTable

Structure xmlAttributeTable
struct _xmlHashTable { The content of this structure is not made public by the API. }

Structure xmlElementTable

Structure xmlElementTable
struct _xmlHashTable { @@ -122,7 +124,7 @@ The content of this structure is not made public by the API. int nodeNr : Depth of the parsing stack int nodeMax : Max depth of the parsing stack xmlNodePtr * nodeTab : array of nodes - int finishDtd : finished validating the Dtd ? + unsigned int finishDtd : finished validating the Dtd ? xmlDocPtr doc : the document int valid : temporary validity check result state s xmlValidState * vstate : current state diff --git a/doc/html/libxml-xmlmemory.html b/doc/html/libxml-xmlmemory.html index 90f91675..23d34167 100644 --- a/doc/html/libxml-xmlmemory.html +++ b/doc/html/libxml-xmlmemory.html @@ -30,6 +30,7 @@ void xmlFreeFunc (void * mem) void * xmlMallocFunc (size_t size)
void *	xmlMallocLoc			(size_t size, 
const char * file,
int line)
+
int	xmlMemBlocks			(void)
void	xmlMemDisplay			(FILE * fp)
void	xmlMemFree			(void * ptr)
int	xmlMemGet			(xmlFreeFunc * freeFunc, 
xmlMallocFunc * mallocFunc,
xmlReallocFunc * reallocFunc,
xmlStrdupFunc * strdupFunc)
@@ -68,7 +69,9 @@ void * xmlMallocFunc (size_t size)

Signature for a malloc() implementation.

size:the size requested in bytes
Returns:a pointer to the newly allocated block or NULL in case of error.

Function: xmlMallocLoc

void *	xmlMallocLoc			(size_t size, 
const char * file,
int line)

a malloc() equivalent, with logging of the allocation info.

-
size:an int specifying the size in byte to allocate.
file:the file name or NULL
line:the line number
Returns:a pointer to the allocated area or NULL in case of lack of memory.

Function: xmlMemDisplay

void	xmlMemDisplay			(FILE * fp)
+
size:an int specifying the size in byte to allocate.
file:the file name or NULL
line:the line number
Returns:a pointer to the allocated area or NULL in case of lack of memory.

Function: xmlMemBlocks

int	xmlMemBlocks			(void)
+

Provides the number of memory areas currently allocated

+
Returns:an int representing the number of blocks

Function: xmlMemDisplay

void	xmlMemDisplay			(FILE * fp)

show in-extenso the memory blocks allocated

fp:a FILE descriptor used as the output file, if NULL, the result is written to the file .memorylist

Function: xmlMemFree

void	xmlMemFree			(void * ptr)

diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index 3da8dbe1..8d243575 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -1557,6 +1557,8 @@ The DTD validation API for the DTD handling and the validity checking Daniel Veillard + + @@ -2578,6 +2580,7 @@ + @@ -3751,6 +3754,12 @@ Bit in the loadsubset context field to tell to do complete the elements attributes lists with the ones defaulted from the DTDs. Use it to initialize xmlLoadExtDtdDefaultValue. + + Special value for finishDtd field when embedded in an xmlParserCtxt + + + Special value for finishDtd field when embedded in an xmlParserCtxt + The default version of XML used: 1.0 @@ -6125,7 +6134,7 @@ actually an xmlCharEncoding'/> - + @@ -9914,6 +9923,10 @@ actually an xmlCharEncoding'/> + + Provides the number of memory areas currently allocated + + show in-extenso the memory blocks allocated diff --git a/doc/libxml2-refs.xml b/doc/libxml2-refs.xml index f00a249a..6c4e3484 100644 --- a/doc/libxml2-refs.xml +++ b/doc/libxml2-refs.xml @@ -217,6 +217,8 @@ + + @@ -2016,6 +2018,7 @@ + @@ -3467,6 +3470,8 @@ + + @@ -5302,6 +5307,7 @@ + @@ -11185,6 +11191,8 @@ + + @@ -12173,6 +12181,7 @@ + @@ -15725,6 +15734,7 @@ + @@ -16396,6 +16406,8 @@ + + @@ -17772,6 +17784,7 @@ + @@ -18066,6 +18079,7 @@ + @@ -19310,6 +19324,7 @@ + @@ -20172,6 +20187,10 @@ + + + + @@ -20769,6 +20788,8 @@ + + @@ -20833,6 +20854,10 @@ + + + + @@ -22095,29 +22120,6 @@ - - - - - - - - - - - - - - - - - - - - - - - @@ -25242,6 +25244,7 @@ + @@ -28380,6 +28383,10 @@ + + + + diff --git a/gentest.py b/gentest.py index 7732d16a..c74942cf 100755 --- a/gentest.py +++ b/gentest.py @@ -21,6 +21,7 @@ skipped_modules = [ "SAX", "SAX2", "xlink", "threads", "globals", # Some function really need to be skipped for the tests. # skipped_functions = [ "xmlFdRead", "xmlReadFd", "xmlCtxtReadFd", + "htmlFdRead", "htmlReadFd", "htmlCtxtReadFd", "xmlCleanupParser" ] # @@ -31,7 +32,33 @@ skipped_memcheck = [ "xmlLoadCatalog", "xmlAddEncodingAlias", "xmlSchemaInitTypes", "xmlNanoFTPProxy", "xmlNanoFTPScanProxy", "xmlNanoHTTPScanProxy", "xmlResetLastError", "xmlCatalogConvert", "xmlCatalogRemove", "xmlLoadCatalogs", "xmlCleanupCharEncodingHandlers", - "xmlInitCharEncodingHandlers" ] + "xmlInitCharEncodingHandlers", "xmlCatalogCleanup", + "htmlParseFile" # loads the catalogs +] + +# +# Extra code needed for some test cases +# +extra_post_call = { + "xmlAddChild": + "if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }", + "xmlAddChildList": + "if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }", + "xmlAddSibling": + "if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }", + "xmlAddNextSibling": + "if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }", + "xmlAddPrevSibling": + "if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }", + "xmlDocSetRootElement": + "if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }", + "xmlReplaceNode": + """if ((old == NULL) || (old->parent == NULL)) { + xmlFreeNode(cur) ; cur = NULL ; }""", + "xmlTextMerge": + """if ((first != NULL) && (first->type != XML_TEXT_NODE)) { + xmlFreeNode(second) ; second = NULL ; }""", +} modules = [] @@ -106,6 +133,8 @@ int main(void) { int ret; int blocks, mem; + xmlInitParser(); + LIBXML_TEST_VERSION xmlSetStructuredErrorFunc(NULL, structured_errors); @@ -161,9 +190,12 @@ for module in modules: # Provide the type generators and destructors for the parameters # -def type_convert(str, name, info, module, function): +def type_convert(str, name, info, module, function, pos): res = string.replace(str, " *", "_ptr") res = string.replace(res, " ", "_") + res = string.replace(res, "htmlNode", "xmlNode") + res = string.replace(res, "htmlDoc", "xmlDoc") + res = string.replace(res, "htmlParser", "xmlParser") if res == 'const_char_ptr': if string.find(name, "file") != -1 or \ string.find(name, "uri") != -1 or \ @@ -179,11 +211,22 @@ def type_convert(str, name, info, module, function): return('xmlNanoFTPCtxtPtr') if module == 'nanohttp' and name == 'ctx': return('xmlNanoHTTPCtxtPtr') + if res == 'xmlNodePtr' and pos != 0: + if (function == 'xmlAddChild' and pos == 2) or \ + (function == 'xmlAddChildList' and pos == 2) or \ + (function == 'xmlAddNextSibling' and pos == 2) or \ + (function == 'xmlAddSibling' and pos == 2) or \ + (function == 'xmlDocSetRootElement' and pos == 2) or \ + (function == 'xmlReplaceNode' and pos == 2) or \ + (function == 'xmlTextMerge') or \ + (function == 'xmlAddPrevSibling' and pos == 2): + return('xmlNodePtr_in'); return res known_param_types = [ "int", "const_char_ptr", "const_xmlChar_ptr", - "xmlParserCtxtPtr", "xmlDocPtr", "filepath", "fileoutput" ]; + "xmlParserCtxtPtr", "xmlDocPtr", "filepath", "fileoutput" , + "xmlNodePtr", "xmlNodePtr_in" ]; def is_known_param_type(name): for type in known_param_types: @@ -265,9 +308,10 @@ static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val) xmlFreeParserCtxt(val); } -#define gen_nb_xmlDocPtr 2 +#define gen_nb_xmlDocPtr 3 static xmlDocPtr gen_xmlDocPtr(int no) { if (no == 0) return(xmlNewDoc(BAD_CAST "1.0")); + if (no == 1) return(xmlReadMemory("", 6, "test", NULL, 0)); return(NULL); } static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val) { @@ -275,6 +319,27 @@ static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val) { xmlFreeDoc(val); } +#define gen_nb_xmlNodePtr 2 +static xmlNodePtr gen_xmlNodePtr(int no) { + if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL)); + return(NULL); +} +static void des_xmlNodePtr(int no ATTRIBUTE_UNUSED, xmlNodePtr val) { + if (val != NULL) { + xmlUnlinkNode(val); + xmlFreeNode(val); + } +} + +#define gen_nb_xmlNodePtr_in 3 +static xmlNodePtr gen_xmlNodePtr_in(int no) { + if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL)); + if (no == 0) return(xmlNewText(BAD_CAST "text")); + return(NULL); +} +static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED) { +} + """); # @@ -364,13 +429,15 @@ test_%s(void) { except: args = [] t_args = [] + n = 0 for arg in args: + n = n + 1 rtype = arg.xpathEval("string(@type)") if rtype == 'void': break; info = arg.xpathEval("string(@info)") nam = arg.xpathEval("string(@name)") - type = type_convert(rtype, nam, info, module, name) + type = type_convert(rtype, nam, info, module, name, n) if is_known_param_type(type) == 0: add_missing_type(type, name); no_gen = 1 @@ -384,7 +451,7 @@ test_%s(void) { for ret in rets: rtype = ret.xpathEval("string(@type)") info = ret.xpathEval("string(@info)") - type = type_convert(rtype, 'return', info, module, name) + type = type_convert(rtype, 'return', info, module, name, 0) if rtype == 'void': break if is_known_return_type(type) == 0: @@ -469,6 +536,9 @@ test_%s(void) { test.write(");\n") test.write(" call_tests++;\n"); + if extra_post_call.has_key(name): + test.write(" %s\n"% (extra_post_call[name])) + # Free the arguments for arg in t_args: (nam, type, rtype, info) = arg; @@ -479,11 +549,15 @@ test_%s(void) { # Check the memory usage if no_mem == 0: test.write(""" if (mem_base != xmlMemBlocks()) { - printf("Leak of %%d blocks found in %s\\n", + printf("Leak of %%d blocks found in %s", xmlMemBlocks() - mem_base); ret++; - } """ % (name)); + for arg in t_args: + (nam, type, rtype, info) = arg; + test.write(""" printf(" %%d", n_%s);\n""" % (nam)) + test.write(""" printf("\\n");\n""") + test.write(" }\n") for arg in t_args: test.write(" }\n") diff --git a/testapi.c b/testapi.c index 5518548b..75faa00e 100644 --- a/testapi.c +++ b/testapi.c @@ -26,6 +26,8 @@ int main(void) { int ret; int blocks, mem; + xmlInitParser(); + LIBXML_TEST_VERSION xmlSetStructuredErrorFunc(NULL, structured_errors); @@ -304,8 +306,45 @@ static int test_htmlAutoCloseTag(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + htmlDocPtr doc; /* the HTML document */ + int n_doc; + const xmlChar * name; /* The tag name */ + int n_name; + htmlNodePtr elem; /* the HTML element */ + int n_elem; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc); + name = gen_const_xmlChar_ptr(n_name); + elem = gen_xmlNodePtr(n_elem); + + ret_val = htmlAutoCloseTag(doc, name, elem); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc); + des_const_xmlChar_ptr(n_name, name); + des_xmlNodePtr(n_elem, elem); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlAutoCloseTag", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf(" %d", n_elem); + printf("\n"); + } + } + } + } +#endif - /* missing type support */ return(ret); } @@ -334,18 +373,59 @@ static int test_htmlCtxtReadDoc(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + const xmlChar * cur; /* a pointer to a zero terminated string */ + int n_cur; + const char * URL; /* the base URL to use for the document */ + int n_URL; + const char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of htmlParserOption(s) */ + int n_options; - /* missing type support */ - return(ret); -} + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt); + cur = gen_const_xmlChar_ptr(n_cur); + URL = gen_filepath(n_URL); + encoding = gen_const_char_ptr(n_encoding); + options = gen_int(n_options); + ret_val = htmlCtxtReadDoc(ctxt, cur, URL, encoding, options); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt); + des_const_xmlChar_ptr(n_cur, cur); + des_filepath(n_URL, URL); + des_const_char_ptr(n_encoding, encoding); + des_int(n_options, options); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlCtxtReadDoc", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + } +#endif -static int -test_htmlCtxtReadFd(void) { - int ret = 0; - - - /* missing type support */ return(ret); } @@ -354,8 +434,52 @@ static int test_htmlCtxtReadFile(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + const char * filename; /* a file or URL */ + int n_filename; + const char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of htmlParserOption(s) */ + int n_options; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt); + filename = gen_filepath(n_filename); + encoding = gen_const_char_ptr(n_encoding); + options = gen_int(n_options); + + ret_val = htmlCtxtReadFile(ctxt, filename, encoding, options); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt); + des_filepath(n_filename, filename); + des_const_char_ptr(n_encoding, encoding); + des_int(n_options, options); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlCtxtReadFile", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_ctxt); + printf(" %d", n_filename); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } +#endif - /* missing type support */ return(ret); } @@ -374,8 +498,66 @@ static int test_htmlCtxtReadMemory(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + const char * buffer; /* a pointer to a char array */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + const char * URL; /* the base URL to use for the document */ + int n_URL; + const char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of htmlParserOption(s) */ + int n_options; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt); + buffer = gen_const_char_ptr(n_buffer); + size = gen_int(n_size); + URL = gen_filepath(n_URL); + encoding = gen_const_char_ptr(n_encoding); + options = gen_int(n_options); + + ret_val = htmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt); + des_const_char_ptr(n_buffer, buffer); + des_int(n_size, size); + des_filepath(n_URL, URL); + des_const_char_ptr(n_encoding, encoding); + des_int(n_options, options); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlCtxtReadMemory", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_ctxt); + printf(" %d", n_buffer); + printf(" %d", n_size); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + } + } +#endif - /* missing type support */ return(ret); } @@ -384,8 +566,29 @@ static int test_htmlCtxtReset(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt); + + htmlCtxtReset(ctxt); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlCtxtReset", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } +#endif - /* missing type support */ return(ret); } @@ -394,8 +597,38 @@ static int test_htmlCtxtUseOptions(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + int options; /* a combination of htmlParserOption(s) */ + int n_options; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt); + options = gen_int(n_options); + + ret_val = htmlCtxtUseOptions(ctxt, options); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt); + des_int(n_options, options); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlCtxtUseOptions", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_ctxt); + printf(" %d", n_options); + printf("\n"); + } + } + } +#endif - /* missing type support */ return(ret); } @@ -470,9 +703,11 @@ test_htmlHandleOmittedElem(void) { des_int(n_val, val); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlHandleOmittedElem\n", + printf("Leak of %d blocks found in htmlHandleOmittedElem", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_val); + printf("\n"); } } #endif @@ -485,8 +720,38 @@ static int test_htmlIsAutoClosed(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + htmlDocPtr doc; /* the HTML document */ + int n_doc; + htmlNodePtr elem; /* the HTML element */ + int n_elem; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc); + elem = gen_xmlNodePtr(n_elem); + + ret_val = htmlIsAutoClosed(doc, elem); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc); + des_xmlNodePtr(n_elem, elem); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlIsAutoClosed", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_doc); + printf(" %d", n_elem); + printf("\n"); + } + } + } +#endif - /* missing type support */ return(ret); } @@ -511,9 +776,11 @@ test_htmlIsScriptAttribute(void) { des_const_xmlChar_ptr(n_name, name); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlIsScriptAttribute\n", + printf("Leak of %d blocks found in htmlIsScriptAttribute", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_name); + printf("\n"); } } #endif @@ -536,8 +803,31 @@ static int test_htmlParseCharRef(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt); + + ret_val = htmlParseCharRef(ctxt); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlParseCharRef", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } +#endif - /* missing type support */ return(ret); } @@ -546,8 +836,54 @@ static int test_htmlParseChunk(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED +#ifdef LIBXML_PUSH_ENABLED + int mem_base; + int ret_val; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + const char * chunk; /* an char array */ + int n_chunk; + int size; /* the size in byte of the chunk */ + int n_size; + int terminate; /* last chunk indicator */ + int n_terminate; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt); + chunk = gen_const_char_ptr(n_chunk); + size = gen_int(n_size); + terminate = gen_int(n_terminate); + + ret_val = htmlParseChunk(ctxt, chunk, size, terminate); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt); + des_const_char_ptr(n_chunk, chunk); + des_int(n_size, size); + des_int(n_terminate, terminate); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlParseChunk", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_ctxt); + printf(" %d", n_chunk); + printf(" %d", n_size); + printf(" %d", n_terminate); + printf("\n"); + } + } + } + } + } +#endif +#endif - /* missing type support */ return(ret); } @@ -566,8 +902,31 @@ static int test_htmlParseDocument(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt); + + ret_val = htmlParseDocument(ctxt); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlParseDocument", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } +#endif - /* missing type support */ return(ret); } @@ -576,8 +935,29 @@ static int test_htmlParseElement(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt); + + htmlParseElement(ctxt); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlParseElement", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } +#endif - /* missing type support */ return(ret); } @@ -596,8 +976,28 @@ static int test_htmlParseFile(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + htmlDocPtr ret_val; + const char * filename; /* the filename */ + int n_filename; + const char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ + int n_encoding; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + filename = gen_filepath(n_filename); + encoding = gen_const_char_ptr(n_encoding); + + ret_val = htmlParseFile(filename, encoding); + desret_xmlDocPtr(ret_val); + call_tests++; + des_filepath(n_filename, filename); + des_const_char_ptr(n_encoding, encoding); + xmlResetLastError(); + } + } +#endif - /* missing type support */ return(ret); } @@ -606,18 +1006,52 @@ static int test_htmlReadDoc(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + const xmlChar * cur; /* a pointer to a zero terminated string */ + int n_cur; + const char * URL; /* the base URL to use for the document */ + int n_URL; + const char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of htmlParserOption(s) */ + int n_options; - /* missing type support */ - return(ret); -} + for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + cur = gen_const_xmlChar_ptr(n_cur); + URL = gen_filepath(n_URL); + encoding = gen_const_char_ptr(n_encoding); + options = gen_int(n_options); + ret_val = htmlReadDoc(cur, URL, encoding, options); + desret_xmlDocPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_cur, cur); + des_filepath(n_URL, URL); + des_const_char_ptr(n_encoding, encoding); + des_int(n_options, options); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlReadDoc", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_cur); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } +#endif -static int -test_htmlReadFd(void) { - int ret = 0; - - - /* missing type support */ return(ret); } @@ -626,8 +1060,45 @@ static int test_htmlReadFile(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + const char * filename; /* a file or URL */ + int n_filename; + const char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of htmlParserOption(s) */ + int n_options; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + filename = gen_filepath(n_filename); + encoding = gen_const_char_ptr(n_encoding); + options = gen_int(n_options); + + ret_val = htmlReadFile(filename, encoding, options); + desret_xmlDocPtr(ret_val); + call_tests++; + des_filepath(n_filename, filename); + des_const_char_ptr(n_encoding, encoding); + des_int(n_options, options); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlReadFile", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_filename); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } +#endif - /* missing type support */ return(ret); } @@ -646,8 +1117,59 @@ static int test_htmlReadMemory(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + const char * buffer; /* a pointer to a char array */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + const char * URL; /* the base URL to use for the document */ + int n_URL; + const char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of htmlParserOption(s) */ + int n_options; + + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + buffer = gen_const_char_ptr(n_buffer); + size = gen_int(n_size); + URL = gen_filepath(n_URL); + encoding = gen_const_char_ptr(n_encoding); + options = gen_int(n_options); + + ret_val = htmlReadMemory(buffer, size, URL, encoding, options); + desret_xmlDocPtr(ret_val); + call_tests++; + des_const_char_ptr(n_buffer, buffer); + des_int(n_size, size); + des_filepath(n_URL, URL); + des_const_char_ptr(n_encoding, encoding); + des_int(n_options, options); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlReadMemory", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_buffer); + printf(" %d", n_size); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + } +#endif - /* missing type support */ return(ret); } @@ -692,7 +1214,6 @@ test_HTMLparser(void) { ret += test_htmlCreateMemoryParserCtxt(); ret += test_htmlCreatePushParserCtxt(); ret += test_htmlCtxtReadDoc(); - ret += test_htmlCtxtReadFd(); ret += test_htmlCtxtReadFile(); ret += test_htmlCtxtReadIO(); ret += test_htmlCtxtReadMemory(); @@ -715,7 +1236,6 @@ test_HTMLparser(void) { ret += test_htmlParseEntityRef(); ret += test_htmlParseFile(); ret += test_htmlReadDoc(); - ret += test_htmlReadFd(); ret += test_htmlReadFile(); ret += test_htmlReadIO(); ret += test_htmlReadMemory(); @@ -798,9 +1318,11 @@ test_htmlIsBooleanAttr(void) { des_const_xmlChar_ptr(n_name, name); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlIsBooleanAttr\n", + printf("Leak of %d blocks found in htmlIsBooleanAttr", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_name); + printf("\n"); } } #endif @@ -813,8 +1335,38 @@ static int test_htmlNewDoc(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + const xmlChar * URI; /* URI for the dtd, or NULL */ + int n_URI; + const xmlChar * ExternalID; /* the external ID of the DTD, or NULL */ + int n_ExternalID; + + for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { + for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { + mem_base = xmlMemBlocks(); + URI = gen_const_xmlChar_ptr(n_URI); + ExternalID = gen_const_xmlChar_ptr(n_ExternalID); + + ret_val = htmlNewDoc(URI, ExternalID); + desret_xmlDocPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_URI, URI); + des_const_xmlChar_ptr(n_ExternalID, ExternalID); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlNewDoc", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_URI); + printf(" %d", n_ExternalID); + printf("\n"); + } + } + } +#endif - /* missing type support */ return(ret); } @@ -823,8 +1375,38 @@ static int test_htmlNewDocNoDtD(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + const xmlChar * URI; /* URI for the dtd, or NULL */ + int n_URI; + const xmlChar * ExternalID; /* the external ID of the DTD, or NULL */ + int n_ExternalID; + + for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { + for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { + mem_base = xmlMemBlocks(); + URI = gen_const_xmlChar_ptr(n_URI); + ExternalID = gen_const_xmlChar_ptr(n_ExternalID); + + ret_val = htmlNewDocNoDtD(URI, ExternalID); + desret_xmlDocPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_URI, URI); + des_const_xmlChar_ptr(n_ExternalID, ExternalID); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlNewDocNoDtD", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_URI); + printf(" %d", n_ExternalID); + printf("\n"); + } + } + } +#endif - /* missing type support */ return(ret); } @@ -905,9 +1487,12 @@ test_htmlSaveFile(void) { des_xmlDocPtr(n_cur, cur); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlSaveFile\n", + printf("Leak of %d blocks found in htmlSaveFile", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_filename); + printf(" %d", n_cur); + printf("\n"); } } } @@ -949,9 +1534,13 @@ test_htmlSaveFileEnc(void) { des_const_char_ptr(n_encoding, encoding); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlSaveFileEnc\n", + printf("Leak of %d blocks found in htmlSaveFileEnc", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_filename); + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf("\n"); } } } @@ -999,9 +1588,14 @@ test_htmlSaveFileFormat(void) { des_int(n_format, format); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlSaveFileFormat\n", + printf("Leak of %d blocks found in htmlSaveFileFormat", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_filename); + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf(" %d", n_format); + printf("\n"); } } } @@ -1018,8 +1612,38 @@ static int test_htmlSetMetaEncoding(void) { int ret = 0; +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + htmlDocPtr doc; /* the document */ + int n_doc; + const xmlChar * encoding; /* the encoding string */ + int n_encoding; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc); + encoding = gen_const_xmlChar_ptr(n_encoding); + + ret_val = htmlSetMetaEncoding(doc, encoding); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc); + des_const_xmlChar_ptr(n_encoding, encoding); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlSetMetaEncoding", + xmlMemBlocks() - mem_base); + ret++; + printf(" %d", n_doc); + printf(" %d", n_encoding); + printf("\n"); + } + } + } +#endif - /* missing type support */ return(ret); } @@ -1205,9 +1829,13 @@ test_xmlCatalogAdd(void) { des_const_xmlChar_ptr(n_replace, replace); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCatalogAdd\n", + printf("Leak of %d blocks found in xmlCatalogAdd", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_type); + printf(" %d", n_orig); + printf(" %d", n_replace); + printf("\n"); } } } @@ -1233,18 +1861,11 @@ test_xmlCatalogCleanup(void) { int ret = 0; #ifdef LIBXML_CATALOG_ENABLED - int mem_base; - mem_base = xmlMemBlocks(); xmlCatalogCleanup(); call_tests++; xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCatalogCleanup\n", - xmlMemBlocks() - mem_base); - ret++; - } #endif return(ret); @@ -1423,9 +2044,11 @@ test_xmlCatalogSetDebug(void) { des_int(n_level, level); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCatalogSetDebug\n", + printf("Leak of %d blocks found in xmlCatalogSetDebug", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_level); + printf("\n"); } } #endif @@ -1477,9 +2100,10 @@ test_xmlInitializeCatalog(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlInitializeCatalog\n", + printf("Leak of %d blocks found in xmlInitializeCatalog", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } #endif @@ -1583,9 +2207,11 @@ test_xmlParseCatalogFile(void) { des_filepath(n_filename, filename); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseCatalogFile\n", + printf("Leak of %d blocks found in xmlParseCatalogFile", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_filename); + printf("\n"); } } #endif @@ -1948,9 +2574,10 @@ test_xmlCleanupEncodingAliases(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCleanupEncodingAliases\n", + printf("Leak of %d blocks found in xmlCleanupEncodingAliases", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } return(ret); @@ -1976,9 +2603,11 @@ test_xmlDelEncodingAlias(void) { des_const_char_ptr(n_alias, alias); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDelEncodingAlias\n", + printf("Leak of %d blocks found in xmlDelEncodingAlias", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_alias); + printf("\n"); } } @@ -2045,9 +2674,11 @@ test_xmlGetEncodingAlias(void) { des_const_char_ptr(n_alias, alias); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetEncodingAlias\n", + printf("Leak of %d blocks found in xmlGetEncodingAlias", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_alias); + printf("\n"); } } @@ -2160,9 +2791,10 @@ test_xmlCleanupPredefinedEntities(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCleanupPredefinedEntities\n", + printf("Leak of %d blocks found in xmlCleanupPredefinedEntities", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } return(ret); @@ -2291,9 +2923,10 @@ test_xmlInitializePredefinedEntities(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlInitializePredefinedEntities\n", + printf("Leak of %d blocks found in xmlInitializePredefinedEntities", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } return(ret); @@ -2896,9 +3529,10 @@ test_xmlNanoFTPCleanup(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPCleanup\n", + printf("Leak of %d blocks found in xmlNanoFTPCleanup", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } #endif @@ -3019,9 +3653,10 @@ test_xmlNanoFTPInit(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPInit\n", + printf("Leak of %d blocks found in xmlNanoFTPInit", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } #endif @@ -3211,9 +3846,10 @@ test_xmlNanoHTTPCleanup(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPCleanup\n", + printf("Leak of %d blocks found in xmlNanoHTTPCleanup", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } #endif @@ -3274,9 +3910,10 @@ test_xmlNanoHTTPInit(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPInit\n", + printf("Leak of %d blocks found in xmlNanoHTTPInit", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } #endif @@ -3460,9 +4097,11 @@ test_xmlClearParserCtxt(void) { des_xmlParserCtxtPtr(n_ctxt, ctxt); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlClearParserCtxt\n", + printf("Leak of %d blocks found in xmlClearParserCtxt", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_ctxt); + printf("\n"); } } @@ -3539,9 +4178,15 @@ test_xmlCtxtReadDoc(void) { des_int(n_options, options); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCtxtReadDoc\n", + printf("Leak of %d blocks found in xmlCtxtReadDoc", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); } } } @@ -3587,9 +4232,14 @@ test_xmlCtxtReadFile(void) { des_int(n_options, options); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCtxtReadFile\n", + printf("Leak of %d blocks found in xmlCtxtReadFile", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_ctxt); + printf(" %d", n_filename); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); } } } @@ -3654,9 +4304,16 @@ test_xmlCtxtReadMemory(void) { des_int(n_options, options); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCtxtReadMemory\n", + printf("Leak of %d blocks found in xmlCtxtReadMemory", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_ctxt); + printf(" %d", n_buffer); + printf(" %d", n_size); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); } } } @@ -3686,9 +4343,11 @@ test_xmlCtxtReset(void) { des_xmlParserCtxtPtr(n_ctxt, ctxt); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCtxtReset\n", + printf("Leak of %d blocks found in xmlCtxtReset", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_ctxt); + printf("\n"); } } @@ -3735,9 +4394,15 @@ test_xmlCtxtResetPush(void) { des_const_char_ptr(n_encoding, encoding); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCtxtResetPush\n", + printf("Leak of %d blocks found in xmlCtxtResetPush", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_ctxt); + printf(" %d", n_chunk); + printf(" %d", n_size); + printf(" %d", n_filename); + printf(" %d", n_encoding); + printf("\n"); } } } @@ -3773,9 +4438,12 @@ test_xmlCtxtUseOptions(void) { des_int(n_options, options); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCtxtUseOptions\n", + printf("Leak of %d blocks found in xmlCtxtUseOptions", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_ctxt); + printf(" %d", n_options); + printf("\n"); } } } @@ -3846,9 +4514,10 @@ test_xmlInitParser(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlInitParser\n", + printf("Leak of %d blocks found in xmlInitParser", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } return(ret); @@ -3874,9 +4543,11 @@ test_xmlInitParserCtxt(void) { des_xmlParserCtxtPtr(n_ctxt, ctxt); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlInitParserCtxt\n", + printf("Leak of %d blocks found in xmlInitParserCtxt", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_ctxt); + printf("\n"); } } @@ -3903,9 +4574,11 @@ test_xmlKeepBlanksDefault(void) { des_int(n_val, val); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlKeepBlanksDefault\n", + printf("Leak of %d blocks found in xmlKeepBlanksDefault", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_val); + printf("\n"); } } @@ -3932,9 +4605,11 @@ test_xmlLineNumbersDefault(void) { des_int(n_val, val); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlLineNumbersDefault\n", + printf("Leak of %d blocks found in xmlLineNumbersDefault", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_val); + printf("\n"); } } @@ -4027,9 +4702,14 @@ test_xmlParseChunk(void) { des_int(n_terminate, terminate); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseChunk\n", + printf("Leak of %d blocks found in xmlParseChunk", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_ctxt); + printf(" %d", n_chunk); + printf(" %d", n_size); + printf(" %d", n_terminate); + printf("\n"); } } } @@ -4090,9 +4770,11 @@ test_xmlParseDocument(void) { des_xmlParserCtxtPtr(n_ctxt, ctxt); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseDocument\n", + printf("Leak of %d blocks found in xmlParseDocument", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_ctxt); + printf("\n"); } } @@ -4119,9 +4801,11 @@ test_xmlParseEntity(void) { des_filepath(n_filename, filename); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseEntity\n", + printf("Leak of %d blocks found in xmlParseEntity", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_filename); + printf("\n"); } } @@ -4148,9 +4832,11 @@ test_xmlParseExtParsedEnt(void) { des_xmlParserCtxtPtr(n_ctxt, ctxt); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseExtParsedEnt\n", + printf("Leak of %d blocks found in xmlParseExtParsedEnt", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_ctxt); + printf("\n"); } } @@ -4187,9 +4873,11 @@ test_xmlParseFile(void) { des_filepath(n_filename, filename); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseFile\n", + printf("Leak of %d blocks found in xmlParseFile", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_filename); + printf("\n"); } } @@ -4231,9 +4919,12 @@ test_xmlParseMemory(void) { des_int(n_size, size); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseMemory\n", + printf("Leak of %d blocks found in xmlParseMemory", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_buffer); + printf(" %d", n_size); + printf("\n"); } } } @@ -4311,9 +5002,11 @@ test_xmlPedanticParserDefault(void) { des_int(n_val, val); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlPedanticParserDefault\n", + printf("Leak of %d blocks found in xmlPedanticParserDefault", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_val); + printf("\n"); } } @@ -4355,9 +5048,14 @@ test_xmlReadDoc(void) { des_int(n_options, options); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReadDoc\n", + printf("Leak of %d blocks found in xmlReadDoc", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_cur); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); } } } @@ -4397,9 +5095,13 @@ test_xmlReadFile(void) { des_int(n_options, options); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReadFile\n", + printf("Leak of %d blocks found in xmlReadFile", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_filename); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); } } } @@ -4458,9 +5160,15 @@ test_xmlReadMemory(void) { des_int(n_options, options); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReadMemory\n", + printf("Leak of %d blocks found in xmlReadMemory", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_buffer); + printf(" %d", n_size); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); } } } @@ -4501,9 +5209,11 @@ test_xmlRecoverFile(void) { des_filepath(n_filename, filename); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRecoverFile\n", + printf("Leak of %d blocks found in xmlRecoverFile", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_filename); + printf("\n"); } } @@ -4535,9 +5245,12 @@ test_xmlRecoverMemory(void) { des_int(n_size, size); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRecoverMemory\n", + printf("Leak of %d blocks found in xmlRecoverMemory", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_buffer); + printf(" %d", n_size); + printf("\n"); } } } @@ -4683,9 +5396,13 @@ test_xmlSetupParserForBuffer(void) { des_filepath(n_filename, filename); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSetupParserForBuffer\n", + printf("Leak of %d blocks found in xmlSetupParserForBuffer", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_ctxt); + printf(" %d", n_buffer); + printf(" %d", n_filename); + printf("\n"); } } } @@ -4712,9 +5429,11 @@ test_xmlStopParser(void) { des_xmlParserCtxtPtr(n_ctxt, ctxt); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStopParser\n", + printf("Leak of %d blocks found in xmlStopParser", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_ctxt); + printf("\n"); } } @@ -4741,9 +5460,11 @@ test_xmlSubstituteEntitiesDefault(void) { des_int(n_val, val); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault\n", + printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_val); + printf("\n"); } } @@ -4871,9 +5592,10 @@ test_xmlRelaxNGCleanupTypes(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRelaxNGCleanupTypes\n", + printf("Leak of %d blocks found in xmlRelaxNGCleanupTypes", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } #endif @@ -5100,22 +5822,26 @@ test_xmlAddChild(void) { xmlNodePtr cur; /* the child node */ int n_cur; - for (n_parent = 0;n_parent < gen_nb_xmlNodePtr_in;n_parent++) { + for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) { mem_base = xmlMemBlocks(); - parent = gen_xmlNodePtr_in(n_parent); + parent = gen_xmlNodePtr(n_parent); cur = gen_xmlNodePtr_in(n_cur); ret_val = xmlAddChild(parent, cur); desret_xmlNodePtr(ret_val); call_tests++; - des_xmlNodePtr_in(n_parent, parent); + if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; } + des_xmlNodePtr(n_parent, parent); des_xmlNodePtr_in(n_cur, cur); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAddChild\n", + printf("Leak of %d blocks found in xmlAddChild", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_parent); + printf(" %d", n_cur); + printf("\n"); } } } @@ -5135,22 +5861,26 @@ test_xmlAddChildList(void) { xmlNodePtr cur; /* the first node in the list */ int n_cur; - for (n_parent = 0;n_parent < gen_nb_xmlNodePtr_in;n_parent++) { + for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) { mem_base = xmlMemBlocks(); - parent = gen_xmlNodePtr_in(n_parent); + parent = gen_xmlNodePtr(n_parent); cur = gen_xmlNodePtr_in(n_cur); ret_val = xmlAddChildList(parent, cur); desret_xmlNodePtr(ret_val); call_tests++; - des_xmlNodePtr_in(n_parent, parent); + if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; } + des_xmlNodePtr(n_parent, parent); des_xmlNodePtr_in(n_cur, cur); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAddChildList\n", + printf("Leak of %d blocks found in xmlAddChildList", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_parent); + printf(" %d", n_cur); + printf("\n"); } } } @@ -5171,21 +5901,25 @@ test_xmlAddNextSibling(void) { int n_elem; for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) { mem_base = xmlMemBlocks(); cur = gen_xmlNodePtr(n_cur); - elem = gen_xmlNodePtr(n_elem); + elem = gen_xmlNodePtr_in(n_elem); ret_val = xmlAddNextSibling(cur, elem); desret_xmlNodePtr(ret_val); call_tests++; + if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; } des_xmlNodePtr(n_cur, cur); - des_xmlNodePtr(n_elem, elem); + des_xmlNodePtr_in(n_elem, elem); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAddNextSibling\n", + printf("Leak of %d blocks found in xmlAddNextSibling", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_cur); + printf(" %d", n_elem); + printf("\n"); } } } @@ -5207,21 +5941,25 @@ test_xmlAddPrevSibling(void) { int n_elem; for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) { mem_base = xmlMemBlocks(); cur = gen_xmlNodePtr(n_cur); - elem = gen_xmlNodePtr(n_elem); + elem = gen_xmlNodePtr_in(n_elem); ret_val = xmlAddPrevSibling(cur, elem); desret_xmlNodePtr(ret_val); call_tests++; + if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; } des_xmlNodePtr(n_cur, cur); - des_xmlNodePtr(n_elem, elem); + des_xmlNodePtr_in(n_elem, elem); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAddPrevSibling\n", + printf("Leak of %d blocks found in xmlAddPrevSibling", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_cur); + printf(" %d", n_elem); + printf("\n"); } } } @@ -5243,21 +5981,25 @@ test_xmlAddSibling(void) { int n_elem; for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) { mem_base = xmlMemBlocks(); cur = gen_xmlNodePtr(n_cur); - elem = gen_xmlNodePtr(n_elem); + elem = gen_xmlNodePtr_in(n_elem); ret_val = xmlAddSibling(cur, elem); desret_xmlNodePtr(ret_val); call_tests++; + if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; } des_xmlNodePtr(n_cur, cur); - des_xmlNodePtr(n_elem, elem); + des_xmlNodePtr_in(n_elem, elem); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAddSibling\n", + printf("Leak of %d blocks found in xmlAddSibling", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_cur); + printf(" %d", n_elem); + printf("\n"); } } } @@ -5491,9 +6233,12 @@ test_xmlCopyDoc(void) { des_int(n_recursive, recursive); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCopyDoc\n", + printf("Leak of %d blocks found in xmlCopyDoc", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf(" %d", n_recursive); + printf("\n"); } } } @@ -5682,9 +6427,11 @@ test_xmlDocGetRootElement(void) { des_xmlDocPtr(n_doc, doc); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDocGetRootElement\n", + printf("Leak of %d blocks found in xmlDocGetRootElement", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf("\n"); } } @@ -5705,21 +6452,25 @@ test_xmlDocSetRootElement(void) { int n_root; for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_root = 0;n_root < gen_nb_xmlNodePtr;n_root++) { + for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) { mem_base = xmlMemBlocks(); doc = gen_xmlDocPtr(n_doc); - root = gen_xmlNodePtr(n_root); + root = gen_xmlNodePtr_in(n_root); ret_val = xmlDocSetRootElement(doc, root); desret_xmlNodePtr(ret_val); call_tests++; + if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; } des_xmlDocPtr(n_doc, doc); - des_xmlNodePtr(n_root, root); + des_xmlNodePtr_in(n_root, root); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDocSetRootElement\n", + printf("Leak of %d blocks found in xmlDocSetRootElement", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf(" %d", n_root); + printf("\n"); } } } @@ -5763,9 +6514,10 @@ test_xmlGetCompressMode(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetCompressMode\n", + printf("Leak of %d blocks found in xmlGetCompressMode", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } return(ret); @@ -5791,9 +6543,11 @@ test_xmlGetDocCompressMode(void) { des_xmlDocPtr(n_doc, doc); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetDocCompressMode\n", + printf("Leak of %d blocks found in xmlGetDocCompressMode", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf("\n"); } } @@ -5830,9 +6584,11 @@ test_xmlGetLastChild(void) { des_xmlNodePtr(n_parent, parent); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetLastChild\n", + printf("Leak of %d blocks found in xmlGetLastChild", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_parent); + printf("\n"); } } @@ -5939,9 +6695,11 @@ test_xmlIsBlankNode(void) { des_xmlNodePtr(n_node, node); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsBlankNode\n", + printf("Leak of %d blocks found in xmlIsBlankNode", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_node); + printf("\n"); } } @@ -5973,9 +6731,12 @@ test_xmlIsXHTML(void) { des_const_xmlChar_ptr(n_publicID, publicID); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsXHTML\n", + printf("Leak of %d blocks found in xmlIsXHTML", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_systemID); + printf(" %d", n_publicID); + printf("\n"); } } } @@ -6013,9 +6774,13 @@ test_xmlNewCDataBlock(void) { des_int(n_len, len); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewCDataBlock\n", + printf("Leak of %d blocks found in xmlNewCDataBlock", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf(" %d", n_content); + printf(" %d", n_len); + printf("\n"); } } } @@ -6049,9 +6814,12 @@ test_xmlNewCharRef(void) { des_const_xmlChar_ptr(n_name, name); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewCharRef\n", + printf("Leak of %d blocks found in xmlNewCharRef", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf("\n"); } } } @@ -6089,9 +6857,11 @@ test_xmlNewComment(void) { des_const_xmlChar_ptr(n_content, content); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewComment\n", + printf("Leak of %d blocks found in xmlNewComment", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_content); + printf("\n"); } } @@ -6118,9 +6888,11 @@ test_xmlNewDoc(void) { des_const_xmlChar_ptr(n_version, version); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDoc\n", + printf("Leak of %d blocks found in xmlNewDoc", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_version); + printf("\n"); } } @@ -6152,9 +6924,12 @@ test_xmlNewDocComment(void) { des_const_xmlChar_ptr(n_content, content); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDocComment\n", + printf("Leak of %d blocks found in xmlNewDocComment", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf(" %d", n_content); + printf("\n"); } } } @@ -6183,9 +6958,11 @@ test_xmlNewDocFragment(void) { des_xmlDocPtr(n_doc, doc); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDocFragment\n", + printf("Leak of %d blocks found in xmlNewDocFragment", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf("\n"); } } #endif @@ -6243,9 +7020,13 @@ test_xmlNewDocPI(void) { des_const_xmlChar_ptr(n_content, content); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDocPI\n", + printf("Leak of %d blocks found in xmlNewDocPI", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf(" %d", n_content); + printf("\n"); } } } @@ -6299,9 +7080,12 @@ test_xmlNewDocText(void) { des_const_xmlChar_ptr(n_content, content); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDocText\n", + printf("Leak of %d blocks found in xmlNewDocText", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf(" %d", n_content); + printf("\n"); } } } @@ -6339,9 +7123,13 @@ test_xmlNewDocTextLen(void) { des_int(n_len, len); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDocTextLen\n", + printf("Leak of %d blocks found in xmlNewDocTextLen", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf(" %d", n_content); + printf(" %d", n_len); + printf("\n"); } } } @@ -6445,9 +7233,12 @@ test_xmlNewPI(void) { des_const_xmlChar_ptr(n_content, content); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewPI\n", + printf("Leak of %d blocks found in xmlNewPI", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_name); + printf(" %d", n_content); + printf("\n"); } } } @@ -6490,9 +7281,12 @@ test_xmlNewReference(void) { des_const_xmlChar_ptr(n_name, name); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewReference\n", + printf("Leak of %d blocks found in xmlNewReference", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf("\n"); } } } @@ -6520,9 +7314,11 @@ test_xmlNewText(void) { des_const_xmlChar_ptr(n_content, content); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewText\n", + printf("Leak of %d blocks found in xmlNewText", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_content); + printf("\n"); } } @@ -6564,9 +7360,12 @@ test_xmlNewTextLen(void) { des_int(n_len, len); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewTextLen\n", + printf("Leak of %d blocks found in xmlNewTextLen", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_content); + printf(" %d", n_len); + printf("\n"); } } } @@ -6597,9 +7396,12 @@ test_xmlNodeAddContent(void) { des_const_xmlChar_ptr(n_content, content); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeAddContent\n", + printf("Leak of %d blocks found in xmlNodeAddContent", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_cur); + printf(" %d", n_content); + printf("\n"); } } } @@ -6635,9 +7437,13 @@ test_xmlNodeAddContentLen(void) { des_int(n_len, len); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeAddContentLen\n", + printf("Leak of %d blocks found in xmlNodeAddContentLen", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_cur); + printf(" %d", n_content); + printf(" %d", n_len); + printf("\n"); } } } @@ -6726,9 +7532,11 @@ test_xmlNodeGetSpacePreserve(void) { des_xmlNodePtr(n_cur, cur); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeGetSpacePreserve\n", + printf("Leak of %d blocks found in xmlNodeGetSpacePreserve", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_cur); + printf("\n"); } } @@ -6755,9 +7563,11 @@ test_xmlNodeIsText(void) { des_xmlNodePtr(n_node, node); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeIsText\n", + printf("Leak of %d blocks found in xmlNodeIsText", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_node); + printf("\n"); } } @@ -6808,9 +7618,12 @@ test_xmlNodeSetBase(void) { des_const_xmlChar_ptr(n_uri, uri); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeSetBase\n", + printf("Leak of %d blocks found in xmlNodeSetBase", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_cur); + printf(" %d", n_uri); + printf("\n"); } } } @@ -6842,9 +7655,12 @@ test_xmlNodeSetContent(void) { des_const_xmlChar_ptr(n_content, content); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeSetContent\n", + printf("Leak of %d blocks found in xmlNodeSetContent", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_cur); + printf(" %d", n_content); + printf("\n"); } } } @@ -6881,9 +7697,13 @@ test_xmlNodeSetContentLen(void) { des_int(n_len, len); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeSetContentLen\n", + printf("Leak of %d blocks found in xmlNodeSetContentLen", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_cur); + printf(" %d", n_content); + printf(" %d", n_len); + printf("\n"); } } } @@ -6917,9 +7737,12 @@ test_xmlNodeSetLang(void) { des_const_xmlChar_ptr(n_lang, lang); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeSetLang\n", + printf("Leak of %d blocks found in xmlNodeSetLang", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_cur); + printf(" %d", n_lang); + printf("\n"); } } } @@ -6952,9 +7775,12 @@ test_xmlNodeSetName(void) { des_const_xmlChar_ptr(n_name, name); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeSetName\n", + printf("Leak of %d blocks found in xmlNodeSetName", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_cur); + printf(" %d", n_name); + printf("\n"); } } } @@ -6987,9 +7813,12 @@ test_xmlNodeSetSpacePreserve(void) { des_int(n_val, val); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeSetSpacePreserve\n", + printf("Leak of %d blocks found in xmlNodeSetSpacePreserve", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_cur); + printf(" %d", n_val); + printf("\n"); } } } @@ -7023,9 +7852,12 @@ test_xmlReconciliateNs(void) { des_xmlNodePtr(n_tree, tree); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReconciliateNs\n", + printf("Leak of %d blocks found in xmlReconciliateNs", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf(" %d", n_tree); + printf("\n"); } } } @@ -7057,21 +7889,26 @@ test_xmlReplaceNode(void) { int n_cur; for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) { mem_base = xmlMemBlocks(); old = gen_xmlNodePtr(n_old); - cur = gen_xmlNodePtr(n_cur); + cur = gen_xmlNodePtr_in(n_cur); ret_val = xmlReplaceNode(old, cur); desret_xmlNodePtr(ret_val); call_tests++; + if ((old == NULL) || (old->parent == NULL)) { + xmlFreeNode(cur) ; cur = NULL ; } des_xmlNodePtr(n_old, old); - des_xmlNodePtr(n_cur, cur); + des_xmlNodePtr_in(n_cur, cur); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReplaceNode\n", + printf("Leak of %d blocks found in xmlReplaceNode", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_old); + printf(" %d", n_cur); + printf("\n"); } } } @@ -7106,9 +7943,12 @@ test_xmlSaveFile(void) { des_xmlDocPtr(n_cur, cur); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSaveFile\n", + printf("Leak of %d blocks found in xmlSaveFile", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_filename); + printf(" %d", n_cur); + printf("\n"); } } } @@ -7148,9 +7988,13 @@ test_xmlSaveFileEnc(void) { des_const_char_ptr(n_encoding, encoding); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSaveFileEnc\n", + printf("Leak of %d blocks found in xmlSaveFileEnc", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_filename); + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf("\n"); } } } @@ -7201,9 +8045,13 @@ test_xmlSaveFormatFile(void) { des_int(n_format, format); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSaveFormatFile\n", + printf("Leak of %d blocks found in xmlSaveFormatFile", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_filename); + printf(" %d", n_cur); + printf(" %d", n_format); + printf("\n"); } } } @@ -7249,9 +8097,14 @@ test_xmlSaveFormatFileEnc(void) { des_int(n_format, format); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSaveFormatFileEnc\n", + printf("Leak of %d blocks found in xmlSaveFormatFileEnc", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_filename); + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf(" %d", n_format); + printf("\n"); } } } @@ -7320,9 +8173,11 @@ test_xmlSetCompressMode(void) { des_int(n_mode, mode); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSetCompressMode\n", + printf("Leak of %d blocks found in xmlSetCompressMode", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_mode); + printf("\n"); } } @@ -7352,9 +8207,12 @@ test_xmlSetDocCompressMode(void) { des_int(n_mode, mode); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSetDocCompressMode\n", + printf("Leak of %d blocks found in xmlSetDocCompressMode", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf(" %d", n_mode); + printf("\n"); } } } @@ -7385,9 +8243,12 @@ test_xmlSetListDoc(void) { des_xmlDocPtr(n_doc, doc); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSetListDoc\n", + printf("Leak of %d blocks found in xmlSetListDoc", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_list); + printf(" %d", n_doc); + printf("\n"); } } } @@ -7448,9 +8309,12 @@ test_xmlSetTreeDoc(void) { des_xmlDocPtr(n_doc, doc); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSetTreeDoc\n", + printf("Leak of %d blocks found in xmlSetTreeDoc", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_tree); + printf(" %d", n_doc); + printf("\n"); } } } @@ -7503,9 +8367,12 @@ test_xmlStringGetNodeList(void) { des_const_xmlChar_ptr(n_value, value); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStringGetNodeList\n", + printf("Leak of %d blocks found in xmlStringGetNodeList", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf(" %d", n_value); + printf("\n"); } } } @@ -7543,9 +8410,13 @@ test_xmlStringLenGetNodeList(void) { des_int(n_len, len); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStringLenGetNodeList\n", + printf("Leak of %d blocks found in xmlStringLenGetNodeList", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf(" %d", n_value); + printf(" %d", n_len); + printf("\n"); } } } @@ -7584,9 +8455,13 @@ test_xmlTextConcat(void) { des_int(n_len, len); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextConcat\n", + printf("Leak of %d blocks found in xmlTextConcat", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_node); + printf(" %d", n_content); + printf(" %d", n_len); + printf("\n"); } } } @@ -7607,22 +8482,27 @@ test_xmlTextMerge(void) { xmlNodePtr second; /* the second text node being merged */ int n_second; - for (n_first = 0;n_first < gen_nb_xmlNodePtr;n_first++) { - for (n_second = 0;n_second < gen_nb_xmlNodePtr;n_second++) { + for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) { + for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) { mem_base = xmlMemBlocks(); - first = gen_xmlNodePtr(n_first); - second = gen_xmlNodePtr(n_second); + first = gen_xmlNodePtr_in(n_first); + second = gen_xmlNodePtr_in(n_second); ret_val = xmlTextMerge(first, second); desret_xmlNodePtr(ret_val); call_tests++; - des_xmlNodePtr(n_first, first); - des_xmlNodePtr(n_second, second); + if ((first != NULL) && (first->type != XML_TEXT_NODE)) { + xmlFreeNode(second) ; second = NULL ; } + des_xmlNodePtr_in(n_first, first); + des_xmlNodePtr_in(n_second, second); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextMerge\n", + printf("Leak of %d blocks found in xmlTextMerge", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_first); + printf(" %d", n_second); + printf("\n"); } } } @@ -7648,9 +8528,11 @@ test_xmlUnlinkNode(void) { des_xmlNodePtr(n_cur, cur); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUnlinkNode\n", + printf("Leak of %d blocks found in xmlUnlinkNode", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_cur); + printf("\n"); } } @@ -7693,9 +8575,12 @@ test_xmlUnsetProp(void) { des_const_xmlChar_ptr(n_name, name); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUnsetProp\n", + printf("Leak of %d blocks found in xmlUnsetProp", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_node); + printf(" %d", n_name); + printf("\n"); } } } @@ -7729,9 +8614,12 @@ test_xmlValidateNCName(void) { des_int(n_space, space); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateNCName\n", + printf("Leak of %d blocks found in xmlValidateNCName", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_value); + printf(" %d", n_space); + printf("\n"); } } } @@ -7764,9 +8652,12 @@ test_xmlValidateNMToken(void) { des_int(n_space, space); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateNMToken\n", + printf("Leak of %d blocks found in xmlValidateNMToken", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_value); + printf(" %d", n_space); + printf("\n"); } } } @@ -7799,9 +8690,12 @@ test_xmlValidateName(void) { des_int(n_space, space); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateName\n", + printf("Leak of %d blocks found in xmlValidateName", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_value); + printf(" %d", n_space); + printf("\n"); } } } @@ -7834,9 +8728,12 @@ test_xmlValidateQName(void) { des_int(n_space, space); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateQName\n", + printf("Leak of %d blocks found in xmlValidateQName", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_value); + printf(" %d", n_space); + printf("\n"); } } } @@ -8408,9 +9305,12 @@ test_xmlIsMixedElement(void) { des_const_xmlChar_ptr(n_name, name); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsMixedElement\n", + printf("Leak of %d blocks found in xmlIsMixedElement", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf("\n"); } } } @@ -8639,9 +9539,11 @@ test_xmlValidateNameValue(void) { des_const_xmlChar_ptr(n_value, value); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateNameValue\n", + printf("Leak of %d blocks found in xmlValidateNameValue", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_value); + printf("\n"); } } #endif @@ -8670,9 +9572,11 @@ test_xmlValidateNamesValue(void) { des_const_xmlChar_ptr(n_value, value); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateNamesValue\n", + printf("Leak of %d blocks found in xmlValidateNamesValue", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_value); + printf("\n"); } } #endif @@ -8701,9 +9605,11 @@ test_xmlValidateNmtokenValue(void) { des_const_xmlChar_ptr(n_value, value); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateNmtokenValue\n", + printf("Leak of %d blocks found in xmlValidateNmtokenValue", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_value); + printf("\n"); } } #endif @@ -8732,9 +9638,11 @@ test_xmlValidateNmtokensValue(void) { des_const_xmlChar_ptr(n_value, value); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateNmtokensValue\n", + printf("Leak of %d blocks found in xmlValidateNmtokensValue", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_value); + printf("\n"); } } #endif @@ -8932,9 +9840,11 @@ test_xmlXIncludeProcess(void) { des_xmlDocPtr(n_doc, doc); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXIncludeProcess\n", + printf("Leak of %d blocks found in xmlXIncludeProcess", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf("\n"); } } #endif @@ -8968,9 +9878,12 @@ test_xmlXIncludeProcessFlags(void) { des_int(n_flags, flags); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXIncludeProcessFlags\n", + printf("Leak of %d blocks found in xmlXIncludeProcessFlags", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_doc); + printf(" %d", n_flags); + printf("\n"); } } } @@ -9010,9 +9923,11 @@ test_xmlXIncludeProcessTree(void) { des_xmlNodePtr(n_tree, tree); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXIncludeProcessTree\n", + printf("Leak of %d blocks found in xmlXIncludeProcessTree", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_tree); + printf("\n"); } } #endif @@ -9046,9 +9961,12 @@ test_xmlXIncludeProcessTreeFlags(void) { des_int(n_flags, flags); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags\n", + printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_tree); + printf(" %d", n_flags); + printf("\n"); } } } @@ -9124,9 +10042,11 @@ test_xmlCheckFilename(void) { des_const_char_ptr(n_path, path); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCheckFilename\n", + printf("Leak of %d blocks found in xmlCheckFilename", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_path); + printf("\n"); } } @@ -9156,9 +10076,10 @@ test_xmlCleanupInputCallbacks(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCleanupInputCallbacks\n", + printf("Leak of %d blocks found in xmlCleanupInputCallbacks", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } return(ret); @@ -9178,9 +10099,10 @@ test_xmlCleanupOutputCallbacks(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCleanupOutputCallbacks\n", + printf("Leak of %d blocks found in xmlCleanupOutputCallbacks", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } #endif @@ -9217,9 +10139,11 @@ test_xmlFileMatch(void) { des_filepath(n_filename, filename); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlFileMatch\n", + printf("Leak of %d blocks found in xmlFileMatch", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_filename); + printf("\n"); } } @@ -9277,9 +10201,11 @@ test_xmlIOFTPMatch(void) { des_filepath(n_filename, filename); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIOFTPMatch\n", + printf("Leak of %d blocks found in xmlIOFTPMatch", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_filename); + printf("\n"); } } #endif @@ -9338,9 +10264,11 @@ test_xmlIOHTTPMatch(void) { des_filepath(n_filename, filename); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIOHTTPMatch\n", + printf("Leak of %d blocks found in xmlIOHTTPMatch", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_filename); + printf("\n"); } } #endif @@ -9603,9 +10531,10 @@ test_xmlPopInputCallbacks(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlPopInputCallbacks\n", + printf("Leak of %d blocks found in xmlPopInputCallbacks", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } return(ret); @@ -9624,9 +10553,10 @@ test_xmlRegisterDefaultInputCallbacks(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks\n", + printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } return(ret); @@ -9646,9 +10576,10 @@ test_xmlRegisterDefaultOutputCallbacks(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks\n", + printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } #endif @@ -9669,9 +10600,10 @@ test_xmlRegisterHTTPPostCallbacks(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks\n", + printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } #endif @@ -11392,9 +12324,10 @@ test_xmlSchemaCleanupTypes(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaCleanupTypes\n", + printf("Leak of %d blocks found in xmlSchemaCleanupTypes", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } #endif @@ -11649,9 +12582,12 @@ test_xmlStrEqual(void) { des_const_xmlChar_ptr(n_str2, str2); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrEqual\n", + printf("Leak of %d blocks found in xmlStrEqual", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_str1); + printf(" %d", n_str2); + printf("\n"); } } } @@ -11699,9 +12635,13 @@ test_xmlStrQEqual(void) { des_const_xmlChar_ptr(n_str, str); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrQEqual\n", + printf("Leak of %d blocks found in xmlStrQEqual", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_pref); + printf(" %d", n_name); + printf(" %d", n_str); + printf("\n"); } } } @@ -11745,9 +12685,12 @@ test_xmlStrcasecmp(void) { des_const_xmlChar_ptr(n_str2, str2); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrcasecmp\n", + printf("Leak of %d blocks found in xmlStrcasecmp", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_str1); + printf(" %d", n_str2); + printf("\n"); } } } @@ -11810,9 +12753,12 @@ test_xmlStrcmp(void) { des_const_xmlChar_ptr(n_str2, str2); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrcmp\n", + printf("Leak of %d blocks found in xmlStrcmp", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_str1); + printf(" %d", n_str2); + printf("\n"); } } } @@ -11850,9 +12796,11 @@ test_xmlStrlen(void) { des_const_xmlChar_ptr(n_str, str); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrlen\n", + printf("Leak of %d blocks found in xmlStrlen", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_str); + printf("\n"); } } @@ -11889,9 +12837,13 @@ test_xmlStrncasecmp(void) { des_int(n_len, len); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrncasecmp\n", + printf("Leak of %d blocks found in xmlStrncasecmp", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_str1); + printf(" %d", n_str2); + printf(" %d", n_len); + printf("\n"); } } } @@ -11950,9 +12902,13 @@ test_xmlStrncmp(void) { des_int(n_len, len); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrncmp\n", + printf("Leak of %d blocks found in xmlStrncmp", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_str1); + printf(" %d", n_str2); + printf(" %d", n_len); + printf("\n"); } } } @@ -12016,9 +12972,12 @@ test_xmlUTF8Charcmp(void) { des_const_xmlChar_ptr(n_utf2, utf2); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUTF8Charcmp\n", + printf("Leak of %d blocks found in xmlUTF8Charcmp", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_utf1); + printf(" %d", n_utf2); + printf("\n"); } } } @@ -12046,9 +13005,11 @@ test_xmlUTF8Size(void) { des_const_xmlChar_ptr(n_utf, utf); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUTF8Size\n", + printf("Leak of %d blocks found in xmlUTF8Size", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_utf); + printf("\n"); } } @@ -12075,9 +13036,11 @@ test_xmlUTF8Strlen(void) { des_const_xmlChar_ptr(n_utf, utf); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUTF8Strlen\n", + printf("Leak of %d blocks found in xmlUTF8Strlen", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_utf); + printf("\n"); } } @@ -12109,9 +13072,12 @@ test_xmlUTF8Strloc(void) { des_const_xmlChar_ptr(n_utfchar, utfchar); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUTF8Strloc\n", + printf("Leak of %d blocks found in xmlUTF8Strloc", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_utf); + printf(" %d", n_utfchar); + printf("\n"); } } } @@ -12164,9 +13130,12 @@ test_xmlUTF8Strsize(void) { des_int(n_len, len); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUTF8Strsize\n", + printf("Leak of %d blocks found in xmlUTF8Strsize", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_utf); + printf(" %d", n_len); + printf("\n"); } } } @@ -13203,9 +14172,11 @@ test_xmlXPathCastStringToBoolean(void) { des_const_xmlChar_ptr(n_val, val); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCastStringToBoolean\n", + printf("Leak of %d blocks found in xmlXPathCastStringToBoolean", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_val); + printf("\n"); } } #endif @@ -13279,9 +14250,12 @@ test_xmlXPathCmpNodes(void) { des_xmlNodePtr(n_node2, node2); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCmpNodes\n", + printf("Leak of %d blocks found in xmlXPathCmpNodes", xmlMemBlocks() - mem_base); ret++; + printf(" %d", n_node1); + printf(" %d", n_node2); + printf("\n"); } } } @@ -13394,9 +14368,10 @@ test_xmlXPathInit(void) { call_tests++; xmlResetLastError(); if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathInit\n", + printf("Leak of %d blocks found in xmlXPathInit", xmlMemBlocks() - mem_base); ret++; + printf("\n"); } #endif diff --git a/tree.c b/tree.c index 1eea2688..87b158ea 100644 --- a/tree.c +++ b/tree.c @@ -2154,6 +2154,7 @@ xmlNewDocPI(xmlDocPtr doc, const xmlChar *name, const xmlChar *content) { if (content != NULL) { cur->content = xmlStrdup(content); } + cur->doc = doc; if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue)) xmlRegisterNodeDefaultValue((xmlNodePtr)cur); @@ -3525,10 +3526,10 @@ xmlUnlinkNode(xmlNodePtr cur) { */ xmlNodePtr xmlReplaceNode(xmlNodePtr old, xmlNodePtr cur) { - if (old == NULL) { + if ((old == NULL) || (old->parent == NULL)) { #ifdef DEBUG_TREE xmlGenericError(xmlGenericErrorContext, - "xmlReplaceNode : old == NULL\n"); + "xmlReplaceNode : old == NULL or without parent\n"); #endif return(NULL); }