diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2001-03-24 17:00:36 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2001-03-24 17:00:36 +0000 |
commit | 56a4cb8c4d3eab4ab3295a61c87e8e92483922c6 (patch) | |
tree | 24cdc196bdb98eb6980c2d27e405fc7e1f1d7bdf /debugXML.c | |
parent | c7ad7ce598261a447cfceb7837219fcd93151336 (diff) | |
download | android_external_libxml2-56a4cb8c4d3eab4ab3295a61c87e8e92483922c6.tar.gz android_external_libxml2-56a4cb8c4d3eab4ab3295a61c87e8e92483922c6.tar.bz2 android_external_libxml2-56a4cb8c4d3eab4ab3295a61c87e8e92483922c6.zip |
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
Diffstat (limited to 'debugXML.c')
-rw-r--r-- | debugXML.c | 114 |
1 files changed, 68 insertions, 46 deletions
@@ -33,6 +33,18 @@ #include <libxml/HTMLparser.h> #include <libxml/xmlerror.h> +/************************************************************************ + * * + * When running GCC in vaacum cleaner mode * + * * + ************************************************************************/ + +#ifdef __GNUC__ +#define UNUSED __attribute__((__unused__)) +#else +#define UNUSED +#endif + #define IS_BLANK(c) \ (((c) == '\n') || ((c) == '\r') || ((c) == '\t') || ((c) == ' ')) @@ -51,7 +63,8 @@ void xmlDebugDumpString(FILE *output, const xmlChar *str) { fprintf(output, "..."); } -void xmlDebugDumpDtd(FILE *output, xmlDtdPtr dtd, int depth) { +static void +xmlDebugDumpDtdNode(FILE *output, xmlDtdPtr dtd, int depth) { int i; char shift[100]; @@ -99,7 +112,8 @@ void xmlDebugDumpDtd(FILE *output, xmlDtdPtr dtd, int depth) { } } -void xmlDebugDumpAttrDecl(FILE *output, xmlAttributePtr attr, int depth) { +static void +xmlDebugDumpAttrDecl(FILE *output, xmlAttributePtr attr, int depth) { int i; char shift[100]; @@ -154,11 +168,11 @@ void xmlDebugDumpAttrDecl(FILE *output, xmlAttributePtr attr, int depth) { break; } if (attr->tree != NULL) { - int i; + int indx; xmlEnumerationPtr cur = attr->tree; - for (i = 0;i < 5; i++) { - if (i != 0) + for (indx = 0;indx < 5; indx++) { + if (indx != 0) fprintf(output, "|%s", cur->name); else fprintf(output, " (%s", cur->name); @@ -215,7 +229,8 @@ void xmlDebugDumpAttrDecl(FILE *output, xmlAttributePtr attr, int depth) { } } -void xmlDebugDumpElemDecl(FILE *output, xmlElementPtr elem, int depth) { +static void +xmlDebugDumpElemDecl(FILE *output, xmlElementPtr elem, int depth) { int i; char shift[100]; @@ -284,7 +299,8 @@ void xmlDebugDumpElemDecl(FILE *output, xmlElementPtr elem, int depth) { } } -void xmlDebugDumpEntityDecl(FILE *output, xmlEntityPtr ent, int depth) { +static void +xmlDebugDumpEntityDecl(FILE *output, xmlEntityPtr ent, int depth) { int i; char shift[100]; @@ -368,7 +384,8 @@ void xmlDebugDumpEntityDecl(FILE *output, xmlEntityPtr ent, int depth) { } } -void xmlDebugDumpNamespace(FILE *output, xmlNsPtr ns, int depth) { +static void +xmlDebugDumpNamespace(FILE *output, xmlNsPtr ns, int depth) { int i; char shift[100]; @@ -397,14 +414,16 @@ void xmlDebugDumpNamespace(FILE *output, xmlNsPtr ns, int depth) { } } -void xmlDebugDumpNamespaceList(FILE *output, xmlNsPtr ns, int depth) { +static void +xmlDebugDumpNamespaceList(FILE *output, xmlNsPtr ns, int depth) { while (ns != NULL) { xmlDebugDumpNamespace(output, ns, depth); ns = ns->next; } } -void xmlDebugDumpEntity(FILE *output, xmlEntityPtr ent, int depth) { +static void +xmlDebugDumpEntity(FILE *output, xmlEntityPtr ent, int depth) { int i; char shift[100]; @@ -563,7 +582,7 @@ void xmlDebugDumpOneNode(FILE *output, xmlNodePtr node, int depth) { fprintf(output, "NOTATION\n"); break; case XML_DTD_NODE: - xmlDebugDumpDtd(output, (xmlDtdPtr) node, depth); + xmlDebugDumpDtdNode(output, (xmlDtdPtr) node, depth); return; case XML_ELEMENT_DECL: xmlDebugDumpElemDecl(output, (xmlElementPtr) node, depth); @@ -786,8 +805,8 @@ void xmlDebugDumpDTD(FILE *output, xmlDtdPtr dtd) { xmlDebugDumpNodeList(output, dtd->children, 1); } -void xmlDebugDumpEntityCallback(xmlEntityPtr cur, FILE *output, - const xmlChar *name) { +static void +xmlDebugDumpEntityCallback(xmlEntityPtr cur, FILE *output) { fprintf(output, "%s : ", cur->name); switch (cur->etype) { case XML_INTERNAL_GENERAL_ENTITY: @@ -1067,9 +1086,9 @@ void xmlLsOneNode(FILE *output, xmlNodePtr node) { * * Returns 0 */ -int -xmlShellList(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, - xmlNodePtr node2) { +static int +xmlShellList(xmlShellCtxtPtr ctxt UNUSED , char *arg UNUSED, xmlNodePtr node, + xmlNodePtr node2 UNUSED) { xmlNodePtr cur; if ((node->type == XML_DOCUMENT_NODE) || @@ -1100,9 +1119,9 @@ xmlShellList(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, * * Returns 0 */ -int -xmlShellDir(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, - xmlNodePtr node2) { +static int +xmlShellDir(xmlShellCtxtPtr ctxt UNUSED, char *arg UNUSED, xmlNodePtr node, + xmlNodePtr node2 UNUSED) { if ((node->type == XML_DOCUMENT_NODE) || (node->type == XML_HTML_DOCUMENT_NODE)) { xmlDebugDumpDocumentHead(stdout, (xmlDocPtr) node); @@ -1126,9 +1145,9 @@ xmlShellDir(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, * * Returns 0 */ -int -xmlShellCat(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, - xmlNodePtr node2) { +static int +xmlShellCat(xmlShellCtxtPtr ctxt, char *arg UNUSED, xmlNodePtr node, + xmlNodePtr node2 UNUSED) { if (ctxt->doc->type == XML_HTML_DOCUMENT_NODE) { #ifdef LIBXML_HTML_ENABLED if (node->type == XML_HTML_DOCUMENT_NODE) @@ -1163,9 +1182,9 @@ xmlShellCat(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, * * Returns 0 or -1 if loading failed */ -int -xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, - xmlNodePtr node2) { +static int +xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node UNUSED, + xmlNodePtr node2 UNUSED) { xmlDocPtr doc; int html = 0; @@ -1215,9 +1234,9 @@ xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, * * Returns 0 or -1 in case of error */ -int +static int xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, - xmlNodePtr node2) { + xmlNodePtr node2 UNUSED) { if (node == NULL) return(-1); if ((filename == NULL) || (filename[0] == 0)) { @@ -1283,9 +1302,9 @@ xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, * * Returns 0 or -1 in case of error */ -int -xmlShellSave(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, - xmlNodePtr node2) { +static int +xmlShellSave(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node UNUSED, + xmlNodePtr node2 UNUSED) { if (ctxt->doc == NULL) return(-1); if ((filename == NULL) || (filename[0] == 0)) @@ -1339,9 +1358,9 @@ xmlShellSave(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, * * Returns 0 or -1 in case of error */ -int -xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd, xmlNodePtr node, - xmlNodePtr node2) { +static int +xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd, xmlNodePtr node UNUSED, + xmlNodePtr node2 UNUSED) { xmlValidCtxt vctxt; int res = -1; @@ -1377,9 +1396,9 @@ xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd, xmlNodePtr node, * * Returns 0 or -1 in case of error */ -int -xmlShellDu(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr tree, - xmlNodePtr node2) { +static int +xmlShellDu(xmlShellCtxtPtr ctxt UNUSED, char *arg UNUSED, xmlNodePtr tree, + xmlNodePtr node2 UNUSED) { xmlNodePtr node; int indent = 0,i; @@ -1453,9 +1472,9 @@ xmlShellDu(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr tree, * * Returns 0 or -1 in case of error */ -int -xmlShellPwd(xmlShellCtxtPtr ctxt, char *buffer, xmlNodePtr node, - xmlNodePtr node2) { +static int +xmlShellPwd(xmlShellCtxtPtr ctxt UNUSED, char *buffer, xmlNodePtr node, + xmlNodePtr node2 UNUSED) { xmlNodePtr cur, tmp, next; char buf[500]; char sep; @@ -1605,6 +1624,7 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, * Parse the command itself */ cur = cmdline; + nbargs = 0; while ((*cur == ' ') || (*cur == '\t')) cur++; i = 0; while ((*cur != ' ') && (*cur != '\t') && @@ -1685,15 +1705,16 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, "%s: no such node\n", arg); break; case XPATH_NODESET: { - int i; + int indx; - for (i = 0;i < list->nodesetval->nodeNr;i++) { + for (indx = 0;indx < list->nodesetval->nodeNr; + indx++) { if (dir) xmlShellDir(ctxt, NULL, - list->nodesetval->nodeTab[i], NULL); + list->nodesetval->nodeTab[indx], NULL); else xmlShellList(ctxt, NULL, - list->nodesetval->nodeTab[i], NULL); + list->nodesetval->nodeTab[indx], NULL); } break; } @@ -1819,12 +1840,13 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, "%s: no such node\n", arg); break; case XPATH_NODESET: { - int i; + int indx; - for (i = 0;i < list->nodesetval->nodeNr;i++) { + for (indx = 0;indx < list->nodesetval->nodeNr; + indx++) { if (i > 0) printf(" -------\n"); xmlShellCat(ctxt, NULL, - list->nodesetval->nodeTab[i], NULL); + list->nodesetval->nodeTab[indx], NULL); } break; } |