Commit 8a32fe48 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

more testing and coverage more cleanups rebuilt Daniel

* gentest.py testapi.c: more testing and coverage
* elfgcchack.h xmlstring.c include/libxml/xmlstring.h: more cleanups
* doc/*: rebuilt
Daniel
parent a03e3656
Tue Nov 2 23:09:06 CET 2004 Daniel Veillard <daniel@veillard.com>
* gentest.py testapi.c: more testing and coverage
* elfgcchack.h xmlstring.c include/libxml/xmlstring.h: more cleanups
* doc/*: rebuilt
Tue Nov 2 19:44:32 CET 2004 Daniel Veillard <daniel@veillard.com>
 
* gentest.py testapi.c: more developments on the API testing
......
......@@ -42,6 +42,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xmlreader.html#xmlTextReaderConstValue">xmlTextReaderConstValue</a><br />
<a href="html/libxml-xmlreader.html#xmlTextReaderConstXmlLang">xmlTextReaderConstXmlLang</a><br />
<a href="html/libxml-xmlreader.html#xmlTextReaderConstXmlVersion">xmlTextReaderConstXmlVersion</a><br />
<a href="html/libxml-xmlstring.html#xmlUTF8Strpos">xmlUTF8Strpos</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNsLookup">xmlXPathNsLookup</a><br />
</p><h2>Type const xmlParserNodeInfo *:</h2><p><a href="html/libxml-parser.html#xmlParserFindNodeInfo">xmlParserFindNodeInfo</a><br />
</p><h2>Type docbDocPtr:</h2><p><a href="html/libxml-DOCBparser.html#docbParseDoc">docbParseDoc</a><br />
......@@ -233,7 +234,6 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-uri.html#xmlURIEscape">xmlURIEscape</a><br />
<a href="html/libxml-uri.html#xmlURIEscapeStr">xmlURIEscapeStr</a><br />
<a href="html/libxml-xmlstring.html#xmlUTF8Strndup">xmlUTF8Strndup</a><br />
<a href="html/libxml-xmlstring.html#xmlUTF8Strpos">xmlUTF8Strpos</a><br />
<a href="html/libxml-xmlstring.html#xmlUTF8Strsub">xmlUTF8Strsub</a><br />
<a href="html/libxml-valid.html#xmlValidCtxtNormalizeAttributeValue">xmlValidCtxtNormalizeAttributeValue</a><br />
<a href="html/libxml-valid.html#xmlValidNormalizeAttributeValue">xmlValidNormalizeAttributeValue</a><br />
......
......@@ -38,7 +38,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<pre class="programlisting">int <a href="#xmlUTF8Strlen">xmlUTF8Strlen</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf)</pre>
<pre class="programlisting">int <a href="#xmlUTF8Strloc">xmlUTF8Strloc</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utfchar)</pre>
<pre class="programlisting"><a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlUTF8Strndup">xmlUTF8Strndup</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int len)</pre>
<pre class="programlisting"><a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlUTF8Strpos">xmlUTF8Strpos</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int pos)</pre>
<pre class="programlisting">const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlUTF8Strpos">xmlUTF8Strpos</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int pos)</pre>
<pre class="programlisting">int <a href="#xmlUTF8Strsize">xmlUTF8Strsize</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int len)</pre>
<pre class="programlisting"><a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlUTF8Strsub">xmlUTF8Strsub</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int start, <br /> int len)</pre>
<h2>Description</h2>
......@@ -97,7 +97,7 @@ A:link, A:visited, A:active { text-decoration: underline }
</pre><p>a function to provide the relative location of a UTF8 char</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>utf</tt></i>:</span></td><td>the input UTF8 *</td></tr><tr><td><span class="term"><i><tt>utfchar</tt></i>:</span></td><td>the UTF8 character to be found</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the relative character position of the desired char or -1 if not found</td></tr></tbody></table></div><h3><a name="xmlUTF8Strndup" id="xmlUTF8Strndup"></a>Function: xmlUTF8Strndup</h3><pre class="programlisting"><a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * xmlUTF8Strndup (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int len)<br />
</pre><p>a strndup for array of UTF8's</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>utf</tt></i>:</span></td><td>the input UTF8 *</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the len of @utf (in chars)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a new UTF8 * or NULL</td></tr></tbody></table></div><h3><a name="xmlUTF8Strpos" id="xmlUTF8Strpos"></a>Function: xmlUTF8Strpos</h3><pre class="programlisting"><a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * xmlUTF8Strpos (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int pos)<br />
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>utf</tt></i>:</span></td><td>the input UTF8 *</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the len of @utf (in chars)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a new UTF8 * or NULL</td></tr></tbody></table></div><h3><a name="xmlUTF8Strpos" id="xmlUTF8Strpos"></a>Function: xmlUTF8Strpos</h3><pre class="programlisting">const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * xmlUTF8Strpos (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int pos)<br />
</pre><p>a function to provide the equivalent of fetching a character from a string array</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>utf</tt></i>:</span></td><td>the input UTF8 *</td></tr><tr><td><span class="term"><i><tt>pos</tt></i>:</span></td><td>the position of the desired UTF8 char (in chars)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the UTF8 character or NULL</td></tr></tbody></table></div><h3><a name="xmlUTF8Strsize" id="xmlUTF8Strsize"></a>Function: xmlUTF8Strsize</h3><pre class="programlisting">int xmlUTF8Strsize (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int len)<br />
</pre><p>storage size of an UTF8 string</p>
......
......@@ -15276,7 +15276,7 @@ actually an xmlCharEncoding'/>
</function>
<function name='xmlUTF8Strpos' file='xmlstring'>
<info>a function to provide the equivalent of fetching a character from a string array</info>
<return type='xmlChar *' info='a pointer to the UTF8 character or NULL'/>
<return type='const xmlChar *' info='a pointer to the UTF8 character or NULL'/>
<arg name='utf' type='const xmlChar *' info='the input UTF8 *'/>
<arg name='pos' type='int' info='the position of the desired UTF8 char (in chars)'/>
</function>
......@@ -6561,6 +6561,7 @@
<ref name='xmlTextReaderConstValue'/>
<ref name='xmlTextReaderConstXmlLang'/>
<ref name='xmlTextReaderConstXmlVersion'/>
<ref name='xmlUTF8Strpos'/>
<ref name='xmlXPathNsLookup'/>
</type>
<type name='const xmlParserNodeInfo *'>
......@@ -6802,7 +6803,6 @@
<ref name='xmlURIEscape'/>
<ref name='xmlURIEscapeStr'/>
<ref name='xmlUTF8Strndup'/>
<ref name='xmlUTF8Strpos'/>
<ref name='xmlUTF8Strsub'/>
<ref name='xmlValidCtxtNormalizeAttributeValue'/>
<ref name='xmlValidNormalizeAttributeValue'/>
......@@ -2154,6 +2154,10 @@ extern __typeof (xmlMallocLoc) xmlMallocLoc__internal_alias __attribute((visibil
extern __typeof (xmlMallocLoc) xmlMallocLoc __attribute((alias("xmlMallocLoc__internal_alias")));
#define xmlMallocLoc xmlMallocLoc__internal_alias
extern __typeof (xmlMemBlocks) xmlMemBlocks__internal_alias __attribute((visibility("hidden")));
extern __typeof (xmlMemBlocks) xmlMemBlocks __attribute((alias("xmlMemBlocks__internal_alias")));
#define xmlMemBlocks xmlMemBlocks__internal_alias
extern __typeof (xmlMemDisplay) xmlMemDisplay__internal_alias __attribute((visibility("hidden")));
extern __typeof (xmlMemDisplay) xmlMemDisplay __attribute((alias("xmlMemDisplay__internal_alias")));
#define xmlMemDisplay xmlMemDisplay__internal_alias
......
......@@ -22,7 +22,7 @@ skipped_modules = [ "SAX", "SAX2", "xlink", "threads", "globals",
#
skipped_functions = [ "xmlFdRead", "xmlReadFd", "xmlCtxtReadFd",
"htmlFdRead", "htmlReadFd", "htmlCtxtReadFd",
"xmlCleanupParser" ]
"xmlCleanupParser", "xmlStrcat", "xmlStrncat" ]
#
# Those functions have side effect on the global state
......@@ -58,6 +58,11 @@ extra_post_call = {
"xmlTextMerge":
"""if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
xmlFreeNode(second) ; second = NULL ; }""",
"xmlBuildQName":
"""if ((ret_val != NULL) && (ret_val != ncname) &&
(ret_val != prefix) && (ret_val != memory))
xmlFree(ret_val);
ret_val = NULL;""",
}
modules = []
......@@ -123,6 +128,8 @@ static int testlibxml2(void);
static int generic_errors = 0;
static int call_tests = 0;
static xmlChar chartab[1024] = " chartab\n";
static void
structured_errors(void *userData ATTRIBUTE_UNUSED,
xmlErrorPtr error ATTRIBUTE_UNUSED) {
......@@ -211,6 +218,8 @@ def type_convert(str, name, info, module, function, pos):
return('xmlNanoFTPCtxtPtr')
if module == 'nanohttp' and name == 'ctx':
return('xmlNanoHTTPCtxtPtr')
if string.find(name, "data") != -1:
return('userdata');
if res == 'xmlNodePtr' and pos != 0:
if (function == 'xmlAddChild' and pos == 2) or \
(function == 'xmlAddChildList' and pos == 2) or \
......@@ -226,7 +235,7 @@ def type_convert(str, name, info, module, function, pos):
known_param_types = [ "int", "const_char_ptr", "const_xmlChar_ptr",
"xmlParserCtxtPtr", "xmlDocPtr", "filepath", "fileoutput" ,
"xmlNodePtr", "xmlNodePtr_in" ];
"xmlNodePtr", "xmlNodePtr_in", "userdata", "xmlChar_ptr" ];
def is_known_param_type(name):
for type in known_param_types:
......@@ -235,6 +244,17 @@ def is_known_param_type(name):
return 0
test.write("""
#define gen_nb_userdata 3
static void *gen_userdata(int no) {
if (no == 0) return((void *) &call_tests);
if (no == 1) return((void *) -1);
return(NULL);
}
static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED) {
}
#define gen_nb_int 4
static int gen_int(int no) {
......@@ -258,6 +278,15 @@ static const char *gen_const_char_ptr(int no) {
static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED) {
}
#define gen_nb_xmlChar_ptr 2
static xmlChar *gen_xmlChar_ptr(int no) {
if (no == 0) return(&chartab);
return(NULL);
}
static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED) {
}
#define gen_nb_const_xmlChar_ptr 5
static const xmlChar *gen_const_xmlChar_ptr(int no) {
......@@ -346,7 +375,8 @@ static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_
# Provide the type destructors for the return values
#
known_return_types = [ "int", "const_char_ptr", "xmlDocPtr", "xmlNodePtr" ];
known_return_types = [ "int", "const_char_ptr", "xmlDocPtr", "xmlNodePtr",
"xmlChar_ptr" ];
def is_known_return_type(name):
for type in known_return_types:
......@@ -359,6 +389,10 @@ static void desret_int(int val ATTRIBUTE_UNUSED) {
}
static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
}
static void desret_xmlChar_ptr(xmlChar *val) {
if (val != NULL)
xmlFree(val);
}
static void desret_xmlDocPtr(xmlDocPtr val) {
xmlFreeDoc(val);
}
......@@ -522,7 +556,10 @@ test_%s(void) {
else:
need = 1
test.write("%s" % nam);
test.write(");\n desret_%s(ret_val);\n" % t_ret[0])
test.write(");\n")
if extra_post_call.has_key(name):
test.write(" %s\n"% (extra_post_call[name]))
test.write(" desret_%s(ret_val);\n" % t_ret[0])
else:
test.write("\n %s(" % (name));
need = 0;
......@@ -534,10 +571,10 @@ test_%s(void) {
need = 1
test.write("%s" % nam)
test.write(");\n")
test.write(" call_tests++;\n");
if extra_post_call.has_key(name):
test.write(" %s\n"% (extra_post_call[name]))
if extra_post_call.has_key(name):
test.write(" %s\n"% (extra_post_call[name]))
test.write(" call_tests++;\n");
# Free the arguments
for arg in t_args:
......
......@@ -117,7 +117,7 @@ XMLPUBFUN int XMLCALL
XMLPUBFUN xmlChar * XMLCALL
xmlUTF8Strndup (const xmlChar *utf,
int len);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN const xmlChar * XMLCALL
xmlUTF8Strpos (const xmlChar *utf,
int pos);
XMLPUBFUN int XMLCALL
......
This diff is collapsed.
......@@ -976,6 +976,7 @@ xmlMallocAtomicLoc
#ifdef DEBUG_MEMORY_LOCATION
xmlMallocLoc
#endif
xmlMemBlocks
xmlMemDisplay
xmlMemFree
xmlMemGet
......
......@@ -478,6 +478,8 @@ xmlStrncatNew(const xmlChar *str1, const xmlChar *str2, int len) {
int size;
xmlChar *ret;
if (len < 0)
len = xmlStrlen(str2);
if ((str2 == NULL) || (len == 0))
return(xmlStrdup(str1));
if (str1 == NULL)
......@@ -869,7 +871,7 @@ xmlUTF8Strndup(const xmlChar *utf, int len) {
*
* Returns a pointer to the UTF8 character or NULL
*/
xmlChar *
const xmlChar *
xmlUTF8Strpos(const xmlChar *utf, int pos) {
xmlChar ch;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment