Huge cleanup, I switched to compile with
-Wall -g -O -ansi -pedantic -W -Wunused -Wimplicit
-Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat
-Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow
-Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return
-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline
- HTMLparser.[ch] HTMLtree.c SAX.c debugXML.c encoding.[ch]
encoding.h entities.c error.c list.[ch] nanoftp.c
nanohttp.c parser.[ch] parserInternals.[ch] testHTML.c
testSAX.c testURI.c testXPath.c tree.[ch] uri.c
valid.[ch] xinclude.c xmlIO.[ch] xmllint.c xmlmemory.c
xpath.c xpathInternals.h xpointer.[ch] example/gjobread.c:
Cleanup, staticfied a number of non-exported functions,
detected and cleaned up a dozen of problem found this way,
avoided a lot of public function name/typedef/system names clashes
- doc/xml.html: updated
- configure.in: switched private flags to the really pedantic ones.
Daniel
diff --git a/xinclude.c b/xinclude.c
index 3c20363..b27773f 100644
--- a/xinclude.c
+++ b/xinclude.c
@@ -79,7 +79,7 @@
*
* Add a new node to process to an XInclude context
*/
-void
+static void
xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) {
if (ctxt->incMax == 0) {
ctxt->incMax = 4;
@@ -128,7 +128,7 @@
*
* Add a new document to the list
*/
-void
+static void
xmlXIncludeAddDoc(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, const xmlURL url) {
if (ctxt->docMax == 0) {
ctxt->docMax = 4;
@@ -177,7 +177,7 @@
*
* Add a new txtument to the list
*/
-void
+static void
xmlXIncludeAddTxt(xmlXIncludeCtxtPtr ctxt, xmlNodePtr txt, const xmlURL url) {
if (ctxt->txtMax == 0) {
ctxt->txtMax = 4;
@@ -226,7 +226,7 @@
*
* Returns the new set
*/
-xmlXIncludeCtxtPtr
+static xmlXIncludeCtxtPtr
xmlXIncludeNewContext(xmlDocPtr doc) {
xmlXIncludeCtxtPtr ret;
@@ -254,7 +254,7 @@
*
* Free an XInclude context
*/
-void
+static void
xmlXIncludeFreeContext(xmlXIncludeCtxtPtr ctxt) {
int i;
@@ -299,7 +299,7 @@
*
* Load the document, and store the result in the XInclude context
*/
-void
+static void
xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
xmlDocPtr doc;
xmlURIPtr uri;
@@ -417,7 +417,7 @@
*
* Load the content, and store the result in the XInclude context
*/
-void
+static void
xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
xmlParserInputBufferPtr buf;
xmlNodePtr node;
@@ -529,7 +529,7 @@
*
* Returns the result list or NULL in case of error
*/
-xmlNodePtr
+static xmlNodePtr
xmlXIncludePreProcessNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) {
xmlXIncludeAddNode(ctxt, node);
return(0);
@@ -544,7 +544,7 @@
*
* Returns 0 if substition succeeded, -1 if some processing failed
*/
-int
+static int
xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
xmlNodePtr cur;
xmlChar *href;
@@ -668,7 +668,7 @@
*
* Returns 0 if substition succeeded, -1 if some processing failed
*/
-int
+static int
xmlXIncludeIncludeNode(xmlXIncludeCtxtPtr ctxt, int nr) {
xmlNodePtr cur, end, list;
@@ -710,15 +710,14 @@
/**
* xmlXIncludeTestNode:
- * @doc: an XML document
* @node: an XInclude node
*
* test if the node is an XInclude node
*
* Returns 1 true, 0 otherwise
*/
-int
-xmlXIncludeTestNode(xmlDocPtr doc, xmlNodePtr node) {
+static int
+xmlXIncludeTestNode(xmlNodePtr node) {
if (node == NULL)
return(0);
if (node->ns == NULL)
@@ -754,18 +753,18 @@
* First phase: lookup the elements in the document
*/
cur = xmlDocGetRootElement(doc);
- if (xmlXIncludeTestNode(doc, cur))
+ if (xmlXIncludeTestNode(cur))
xmlXIncludePreProcessNode(ctxt, cur);
while (cur != NULL) {
/* TODO: need to work on entities -> stack */
if ((cur->children != NULL) &&
(cur->children->type != XML_ENTITY_DECL)) {
cur = cur->children;
- if (xmlXIncludeTestNode(doc, cur))
+ if (xmlXIncludeTestNode(cur))
xmlXIncludePreProcessNode(ctxt, cur);
} else if (cur->next != NULL) {
cur = cur->next;
- if (xmlXIncludeTestNode(doc, cur))
+ if (xmlXIncludeTestNode(cur))
xmlXIncludePreProcessNode(ctxt, cur);
} else {
do {
@@ -773,7 +772,7 @@
if (cur == NULL) break; /* do */
if (cur->next != NULL) {
cur = cur->next;
- if (xmlXIncludeTestNode(doc, cur))
+ if (xmlXIncludeTestNode(cur))
xmlXIncludePreProcessNode(ctxt, cur);
break; /* do */
}