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/example/gjobread.c b/example/gjobread.c
index e415173..fd83c13 100644
--- a/example/gjobread.c
+++ b/example/gjobread.c
@@ -42,7 +42,8 @@
/*
* And the code needed to parse it
*/
-personPtr parsePerson(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) {
+static personPtr
+parsePerson(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) {
personPtr ret = NULL;
DEBUG("parsePerson\n");
@@ -75,7 +76,8 @@
/*
* and to print it
*/
-void printPerson(personPtr cur) {
+static void
+printPerson(personPtr cur) {
if (cur == NULL) return;
printf("------ Person\n");
if (cur->name) printf(" name: %s\n", cur->name);
@@ -103,7 +105,8 @@
/*
* And the code needed to parse it
*/
-jobPtr parseJob(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) {
+static jobPtr
+parseJob(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) {
jobPtr ret = NULL;
DEBUG("parseJob\n");
@@ -148,7 +151,8 @@
/*
* and to print it
*/
-void printJob(jobPtr cur) {
+static void
+printJob(jobPtr cur) {
int i;
if (cur == NULL) return;
@@ -172,10 +176,11 @@
} gJob, *gJobPtr;
-gJobPtr parseGjobFile(char *filename) {
+static gJobPtr
+parseGjobFile(char *filename) {
xmlDocPtr doc;
gJobPtr ret;
- jobPtr job;
+ jobPtr curjob;
xmlNsPtr ns;
xmlNodePtr cur;
@@ -247,9 +252,9 @@
while (cur != NULL) {
if ((!xmlStrcmp(cur->name, (const xmlChar *) "Job")) &&
(cur->ns == ns)) {
- job = parseJob(doc, ns, cur);
- if (job != NULL)
- ret->jobs[ret->nbJobs++] = job;
+ curjob = parseJob(doc, ns, cur);
+ if (curjob != NULL)
+ ret->jobs[ret->nbJobs++] = curjob;
if (ret->nbJobs >= 500) break;
}
cur = cur->next;
@@ -258,7 +263,8 @@
return(ret);
}
-void handleGjob(gJobPtr cur) {
+static void
+handleGjob(gJobPtr cur) {
int i;
/*