Commit 24505b0f authored by Daniel Veillard's avatar Daniel Veillard

a lot of small cleanups based on Linus' sparse check output. Daniel

* HTMLparser.c SAX2.c encoding.c globals.c parser.c relaxng.c
  runsuite.c runtest.c schematron.c testHTML.c testReader.c
  testRegexp.c testSAX.c testThreads.c valid.c xinclude.c xmlIO.c
  xmllint.c xmlmodule.c xmlschemas.c xpath.c xpointer.c: a lot of
  small cleanups based on Linus' sparse check output.
Daniel
parent 4cd3b519
Fri Jul 29 01:48:02 CEST 2005 Daniel Veillard <daniel@veillard.com>
* HTMLparser.c SAX2.c encoding.c globals.c parser.c relaxng.c
runsuite.c runtest.c schematron.c testHTML.c testReader.c
testRegexp.c testSAX.c testThreads.c valid.c xinclude.c xmlIO.c
xmllint.c xmlmodule.c xmlschemas.c xpath.c xpointer.c: a lot of
small cleanups based on Linus' sparse check output.
Thu Jul 28 21:28:33 CEST 2005 Daniel Veillard <daniel@veillard.com>
* include/libxml/Makefile.am: added schematron.h, oops ...
......
......@@ -192,16 +192,16 @@ htmlnamePop(htmlParserCtxtPtr ctxt)
const xmlChar *ret;
if (ctxt->nameNr <= 0)
return (0);
return (NULL);
ctxt->nameNr--;
if (ctxt->nameNr < 0)
return (0);
return (NULL);
if (ctxt->nameNr > 0)
ctxt->name = ctxt->nameTab[ctxt->nameNr - 1];
else
ctxt->name = NULL;
ret = ctxt->nameTab[ctxt->nameNr];
ctxt->nameTab[ctxt->nameNr] = 0;
ctxt->nameTab[ctxt->nameNr] = NULL;
return (ret);
}
......
......@@ -227,7 +227,7 @@ const xmlChar *
xmlSAX2GetSystemId(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
if ((ctx == NULL) || (ctxt->input == NULL)) return(0);
if ((ctx == NULL) || (ctxt->input == NULL)) return(NULL);
return((const xmlChar *) ctxt->input->filename);
}
......
......@@ -1239,7 +1239,7 @@ xmlNewCharEncodingHandler(const char *name,
const char *alias;
char upper[500];
int i;
char *up = 0;
char *up = NULL;
/*
* Do the alias resolution
......
......@@ -344,7 +344,7 @@ static const char *xmlTreeIndentStringThrDef = " ";
* Disabled by default
*/
int xmlSaveNoEmptyTags = 0;
int xmlSaveNoEmptyTagsThrDef = 0;
static int xmlSaveNoEmptyTagsThrDef = 0;
#ifdef LIBXML_SAX1_ENABLED
/**
......
......@@ -984,14 +984,14 @@ inputPop(xmlParserCtxtPtr ctxt)
if (ctxt == NULL)
return(NULL);
if (ctxt->inputNr <= 0)
return (0);
return (NULL);
ctxt->inputNr--;
if (ctxt->inputNr > 0)
ctxt->input = ctxt->inputTab[ctxt->inputNr - 1];
else
ctxt->input = NULL;
ret = ctxt->inputTab[ctxt->inputNr];
ctxt->inputTab[ctxt->inputNr] = 0;
ctxt->inputTab[ctxt->inputNr] = NULL;
return (ret);
}
/**
......@@ -1053,7 +1053,7 @@ nodePop(xmlParserCtxtPtr ctxt)
else
ctxt->node = NULL;
ret = ctxt->nodeTab[ctxt->nodeNr];
ctxt->nodeTab[ctxt->nodeNr] = 0;
ctxt->nodeTab[ctxt->nodeNr] = NULL;
return (ret);
}
......@@ -1118,7 +1118,7 @@ nameNsPop(xmlParserCtxtPtr ctxt)
const xmlChar *ret;
if (ctxt->nameNr <= 0)
return (0);
return (NULL);
ctxt->nameNr--;
if (ctxt->nameNr > 0)
ctxt->name = ctxt->nameTab[ctxt->nameNr - 1];
......@@ -1184,7 +1184,7 @@ namePop(xmlParserCtxtPtr ctxt)
else
ctxt->name = NULL;
ret = ctxt->nameTab[ctxt->nameNr];
ctxt->nameTab[ctxt->nameNr] = 0;
ctxt->nameTab[ctxt->nameNr] = NULL;
return (ret);
}
......
......@@ -1477,14 +1477,14 @@ xmlRelaxNGIncludePop(xmlRelaxNGParserCtxtPtr ctxt)
xmlRelaxNGIncludePtr ret;
if (ctxt->incNr <= 0)
return (0);
return (NULL);
ctxt->incNr--;
if (ctxt->incNr > 0)
ctxt->inc = ctxt->incTab[ctxt->incNr - 1];
else
ctxt->inc = NULL;
ret = ctxt->incTab[ctxt->incNr];
ctxt->incTab[ctxt->incNr] = 0;
ctxt->incTab[ctxt->incNr] = NULL;
return (ret);
}
......@@ -1889,14 +1889,14 @@ xmlRelaxNGDocumentPop(xmlRelaxNGParserCtxtPtr ctxt)
xmlRelaxNGDocumentPtr ret;
if (ctxt->docNr <= 0)
return (0);
return (NULL);
ctxt->docNr--;
if (ctxt->docNr > 0)
ctxt->doc = ctxt->docTab[ctxt->docNr - 1];
else
ctxt->doc = NULL;
ret = ctxt->docTab[ctxt->docNr];
ctxt->docTab[ctxt->docNr] = 0;
ctxt->docTab[ctxt->docNr] = NULL;
return (ret);
}
......
......@@ -30,8 +30,8 @@
#include <libxml/xmlschemastypes.h>
#define LOGFILE "runsuite.log"
FILE *logfile = NULL;
int verbose = 0;
static FILE *logfile = NULL;
static int verbose = 0;
#if defined(_WIN32) && !defined(__CYGWIN__)
#define vsnprintf _vsnprintf
......@@ -96,9 +96,9 @@ fatalError(void) {
* that's needed to implement <resource>
*/
#define MAX_ENTITIES 20
char *testEntitiesName[MAX_ENTITIES];
char *testEntitiesValue[MAX_ENTITIES];
int nb_entities = 0;
static char *testEntitiesName[MAX_ENTITIES];
static char *testEntitiesValue[MAX_ENTITIES];
static int nb_entities = 0;
static void resetEntities(void) {
int i;
......@@ -205,7 +205,7 @@ testErrorHandler(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
testErrors[testErrorsSize] = 0;
}
xmlXPathContextPtr ctxtXPath;
static xmlXPathContextPtr ctxtXPath;
static void
initializeLibxml2(void) {
......
......@@ -714,12 +714,12 @@ static int unloadMem(const char *mem) {
* *
************************************************************************/
FILE *SAXdebug = NULL;
static FILE *SAXdebug = NULL;
/*
* empty SAX block
*/
xmlSAXHandler emptySAXHandlerStruct = {
static xmlSAXHandler emptySAXHandlerStruct = {
NULL, /* internalSubset */
NULL, /* isStandalone */
NULL, /* hasInternalSubset */
......@@ -755,8 +755,8 @@ xmlSAXHandler emptySAXHandlerStruct = {
};
static xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct;
int callbacks = 0;
int quiet = 0;
static int callbacks = 0;
static int quiet = 0;
/**
* isStandaloneDebug:
......@@ -1347,7 +1347,7 @@ fatalErrorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
va_end(args);
}
xmlSAXHandler debugSAXHandlerStruct = {
static xmlSAXHandler debugSAXHandlerStruct = {
internalSubsetDebug,
isStandaloneDebug,
hasInternalSubsetDebug,
......@@ -1382,7 +1382,7 @@ xmlSAXHandler debugSAXHandlerStruct = {
NULL
};
xmlSAXHandlerPtr debugSAXHandler = &debugSAXHandlerStruct;
static xmlSAXHandlerPtr debugSAXHandler = &debugSAXHandlerStruct;
/*
* SAX2 specific callbacks
......@@ -1471,7 +1471,7 @@ endElementNsDebug(void *ctx ATTRIBUTE_UNUSED,
fprintf(SAXdebug, ", '%s')\n", (char *) URI);
}
xmlSAXHandler debugSAX2HandlerStruct = {
static xmlSAXHandler debugSAX2HandlerStruct = {
internalSubsetDebug,
isStandaloneDebug,
hasInternalSubsetDebug,
......@@ -1506,7 +1506,7 @@ xmlSAXHandler debugSAX2HandlerStruct = {
NULL
};
xmlSAXHandlerPtr debugSAX2Handler = &debugSAX2HandlerStruct;
static xmlSAXHandlerPtr debugSAX2Handler = &debugSAX2HandlerStruct;
#ifdef LIBXML_HTML_ENABLED
/**
......@@ -1586,7 +1586,7 @@ htmlcdataDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len)
fprintf(SAXdebug, "SAX.cdata(%s, %d)\n", output, len);
}
xmlSAXHandler debugHTMLSAXHandlerStruct = {
static xmlSAXHandler debugHTMLSAXHandlerStruct = {
internalSubsetDebug,
isStandaloneDebug,
hasInternalSubsetDebug,
......@@ -1621,7 +1621,7 @@ xmlSAXHandler debugHTMLSAXHandlerStruct = {
NULL
};
xmlSAXHandlerPtr debugHTMLSAXHandler = &debugHTMLSAXHandlerStruct;
static xmlSAXHandlerPtr debugHTMLSAXHandler = &debugHTMLSAXHandlerStruct;
#endif /* LIBXML_HTML_ENABLED */
#ifdef LIBXML_SAX1_ENABLED
......@@ -2247,8 +2247,8 @@ streamMemParseTest(const char *filename, const char *result, const char *err,
* *
************************************************************************/
FILE *xpathOutput;
xmlDocPtr xpathDocument;
static FILE *xpathOutput;
static xmlDocPtr xpathDocument;
static void
testXPath(const char *str, int xptr, int expr) {
......@@ -3667,8 +3667,8 @@ static const char *testfiles[] = {
"test/threads/invalid.xml",
};
const char *Okay = "OK";
const char *Failed = "Failed";
static const char *Okay = "OK";
static const char *Failed = "Failed";
#ifndef xmlDoValidityCheckingDefaultValue
#error xmlDoValidityCheckingDefaultValue is not a macro
......
......@@ -470,7 +470,7 @@ xmlSchematronNewParserCtxt(const char *URL)
ret->type = XML_STRON_CTXT_PARSER;
ret->dict = xmlDictCreate();
ret->URL = xmlDictLookup(ret->dict, (const xmlChar *) URL, -1);
ret->includes = 0;
ret->includes = NULL;
ret->xctxt = xmlXPathNewContext(NULL);
if (ret->xctxt == NULL) {
xmlSchematronPErrMemory(NULL, "allocating schema parser XPath context",
......
......@@ -50,7 +50,7 @@ static int push = 0;
static char *encoding = NULL;
static int options = 0;
xmlSAXHandler emptySAXHandlerStruct = {
static xmlSAXHandler emptySAXHandlerStruct = {
NULL, /* internalSubset */
NULL, /* isStandalone */
NULL, /* hasInternalSubset */
......@@ -85,7 +85,7 @@ xmlSAXHandler emptySAXHandlerStruct = {
NULL /* xmlStructuredErrorFunc */
};
xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct;
static xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct;
extern xmlSAXHandlerPtr debugSAXHandler;
/************************************************************************
......@@ -574,7 +574,7 @@ fatalErrorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
va_end(args);
}
xmlSAXHandler debugSAXHandlerStruct = {
static xmlSAXHandler debugSAXHandlerStruct = {
internalSubsetDebug,
isStandaloneDebug,
hasInternalSubsetDebug,
......
......@@ -34,12 +34,12 @@
#include <libxml/xmlreader.h>
int debug = 0;
int dump = 0;
int noent = 0;
int count = 0;
int valid = 0;
int consumed = 0;
static int debug = 0;
static int dump = 0;
static int noent = 0;
static int count = 0;
static int valid = 0;
static int consumed = 0;
static void usage(const char *progname) {
printf("Usage : %s [options] XMLfiles ...\n", progname);
......
......@@ -12,8 +12,8 @@
#include <libxml/tree.h>
#include <libxml/xmlregexp.h>
int repeat = 0;
int debug = 0;
static int repeat = 0;
static int debug = 0;
static void testRegexp(xmlRegexpPtr comp, const char *value) {
int ret;
......
......@@ -200,7 +200,7 @@ endTimer(char *format, ...)
/*
* empty SAX block
*/
xmlSAXHandler emptySAXHandlerStruct = {
static xmlSAXHandler emptySAXHandlerStruct = {
NULL, /* internalSubset */
NULL, /* isStandalone */
NULL, /* hasInternalSubset */
......@@ -235,7 +235,7 @@ xmlSAXHandler emptySAXHandlerStruct = {
NULL /* xmlStructuredErrorFunc */
};
xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct;
static xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct;
extern xmlSAXHandlerPtr debugSAXHandler;
/************************************************************************
......@@ -833,7 +833,7 @@ fatalErrorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
va_end(args);
}
xmlSAXHandler debugSAXHandlerStruct = {
static xmlSAXHandler debugSAXHandlerStruct = {
internalSubsetDebug,
isStandaloneDebug,
hasInternalSubsetDebug,
......@@ -957,7 +957,7 @@ endElementNsDebug(void *ctx ATTRIBUTE_UNUSED,
fprintf(stdout, ", '%s')\n", (char *) URI);
}
xmlSAXHandler debugSAX2HandlerStruct = {
static xmlSAXHandler debugSAX2HandlerStruct = {
internalSubsetDebug,
isStandaloneDebug,
hasInternalSubsetDebug,
......@@ -992,7 +992,7 @@ xmlSAXHandler debugSAX2HandlerStruct = {
NULL
};
xmlSAXHandlerPtr debugSAX2Handler = &debugSAX2HandlerStruct;
static xmlSAXHandlerPtr debugSAX2Handler = &debugSAX2HandlerStruct;
/************************************************************************
* *
......
......@@ -36,8 +36,8 @@ static const char *testfiles[] = {
"test/threads/invalid.xml",
};
const char *Okay = "OK";
const char *Failed = "Failed";
static const char *Okay = "OK";
static const char *Failed = "Failed";
#ifndef xmlDoValidityCheckingDefaultValue
#error xmlDoValidityCheckingDefaultValue is not a macro
......@@ -110,7 +110,7 @@ main(void)
}
for (i = 0; i < num_threads; i++) {
ret = pthread_create(&tid[i], 0, thread_specific_data,
ret = pthread_create(&tid[i], NULL, thread_specific_data,
(void *) testfiles[i]);
if (ret != 0) {
perror("pthread_create");
......
......@@ -453,14 +453,14 @@ nodeVPop(xmlValidCtxtPtr ctxt)
xmlNodePtr ret;
if (ctxt->nodeNr <= 0)
return (0);
return (NULL);
ctxt->nodeNr--;
if (ctxt->nodeNr > 0)
ctxt->node = ctxt->nodeTab[ctxt->nodeNr - 1];
else
ctxt->node = NULL;
ret = ctxt->nodeTab[ctxt->nodeNr];
ctxt->nodeTab[ctxt->nodeNr] = 0;
ctxt->nodeTab[ctxt->nodeNr] = NULL;
return (ret);
}
......@@ -3866,7 +3866,7 @@ xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
fullname = xmlBuildQName(elem->name, elem->ns->prefix, fn, 50);
if (fullname == NULL)
return(0);
return(NULL);
attrDecl = xmlGetDtdAttrDesc(doc->intSubset, fullname, name);
if ((attrDecl == NULL) && (doc->extSubset != NULL)) {
attrDecl = xmlGetDtdAttrDesc(doc->extSubset, fullname, name);
......@@ -3951,7 +3951,7 @@ xmlValidNormalizeAttributeValue(xmlDocPtr doc, xmlNodePtr elem,
fullname = xmlBuildQName(elem->name, elem->ns->prefix, fn, 50);
if (fullname == NULL)
return(0);
return(NULL);
attrDecl = xmlGetDtdAttrDesc(doc->intSubset, fullname, name);
if ((attrDecl == NULL) && (doc->extSubset != NULL))
attrDecl = xmlGetDtdAttrDesc(doc->extSubset, fullname, name);
......
......@@ -237,7 +237,7 @@ xmlXIncludeNewRef(xmlXIncludeCtxtPtr ctxt, const xmlChar *URI,
ret->URI = xmlStrdup(URI);
ret->fragment = NULL;
ret->ref = ref;
ret->doc = 0;
ret->doc = NULL;
ret->count = 0;
ret->xml = 0;
ret->inc = NULL;
......@@ -360,7 +360,7 @@ xmlXIncludeURLPop(xmlXIncludeCtxtPtr ctxt)
else
ctxt->url = NULL;
ret = ctxt->urlTab[ctxt->urlNr];
ctxt->urlTab[ctxt->urlNr] = 0;
ctxt->urlTab[ctxt->urlNr] = NULL;
if (ret != NULL)
xmlFree(ret);
}
......@@ -1952,7 +1952,7 @@ xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback, int nr) {
static xmlNodePtr
xmlXIncludePreProcessNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) {
xmlXIncludeAddNode(ctxt, node);
return(0);
return(NULL);
}
/**
......
......@@ -1206,7 +1206,7 @@ xmlCreateZMemBuff( int compression ) {
}
/* Set the header data. The CRC will be needed for the trailer */
buff->crc = crc32( 0L, Z_NULL, 0 );
buff->crc = crc32( 0L, NULL, 0 );
hdr_lgth = snprintf( (char *)buff->zbuff, buff->size,
"%c%c%c%c%c%c%c%c%c%c",
GZ_MAGIC1, GZ_MAGIC2, Z_DEFLATED,
......
......@@ -235,7 +235,7 @@ void parsePath(const xmlChar *path) {
}
}
xmlExternalEntityLoader defaultEntityLoader = NULL;
static xmlExternalEntityLoader defaultEntityLoader = NULL;
static xmlParserInputPtr
xmllintExternalEntityLoader(const char *URL, const char *ID,
......@@ -508,7 +508,7 @@ endTimer(char *format, ...)
* HTML ouput *
* *
************************************************************************/
char buffer[50000];
static char buffer[50000];
static void
xmlHTMLEncodeSend(void) {
......@@ -817,7 +817,7 @@ static void myClose(FILE *f) {
/*
* empty SAX block
*/
xmlSAXHandler emptySAXHandlerStruct = {
static xmlSAXHandler emptySAXHandlerStruct = {
NULL, /* internalSubset */
NULL, /* isStandalone */
NULL, /* hasInternalSubset */
......@@ -852,7 +852,7 @@ xmlSAXHandler emptySAXHandlerStruct = {
NULL /* xmlStructuredErrorFunc */
};
xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct;
static xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct;
extern xmlSAXHandlerPtr debugSAXHandler;
static int callbacks;
......@@ -1440,7 +1440,7 @@ fatalErrorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
va_end(args);
}
xmlSAXHandler debugSAXHandlerStruct = {
static xmlSAXHandler debugSAXHandlerStruct = {
internalSubsetDebug,
isStandaloneDebug,
hasInternalSubsetDebug,
......@@ -1564,7 +1564,7 @@ endElementNsDebug(void *ctx ATTRIBUTE_UNUSED,
fprintf(stdout, ", '%s')\n", (char *) URI);
}
xmlSAXHandler debugSAX2HandlerStruct = {
static xmlSAXHandler debugSAX2HandlerStruct = {
internalSubsetDebug,
isStandaloneDebug,
hasInternalSubsetDebug,
......@@ -1599,7 +1599,7 @@ xmlSAXHandler debugSAX2HandlerStruct = {
NULL
};
xmlSAXHandlerPtr debugSAX2Handler = &debugSAX2HandlerStruct;
static xmlSAXHandlerPtr debugSAX2Handler = &debugSAX2HandlerStruct;
static void
testSAX(const char *filename) {
......
......@@ -85,7 +85,7 @@ xmlModuleOpen(const char *name, int options ATTRIBUTE_UNUSED)
__xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_MODULE,
XML_MODULE_OPEN, XML_ERR_FATAL, NULL, 0, 0,
name, NULL, 0, 0, "failed to open %s\n", name);
return 0;
return(NULL);
}
module->name = xmlStrdup((const xmlChar *) name);
......@@ -179,7 +179,7 @@ xmlModuleFree(xmlModulePtr module)
{
if (NULL == module) {
__xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_MODULE,
XML_MODULE_CLOSE, XML_ERR_FATAL, NULL, 0, 0,
XML_MODULE_CLOSE, XML_ERR_FATAL, NULL, 0, NULL,
NULL, NULL, 0, 0, "null module pointer\n");
return -1;
}
......
......@@ -5023,7 +5023,7 @@ xmlSchemaPValAttrNodeQNameValue(xmlSchemaParserCtxtPtr ctxt,
return (-1);
if (!strchr((char *) value, ':')) {
ns = xmlSearchNs(attr->doc, attr->parent, 0);
ns = xmlSearchNs(attr->doc, attr->parent, NULL);
if (ns)
*uri = xmlDictLookup(ctxt->dict, ns->href, -1);
else if (schema->flags & XML_SCHEMAS_INCLUDING_CONVERT_NS) {
......@@ -12827,7 +12827,7 @@ xmlSchemaBuildAttributeValidation(xmlSchemaParserCtxtPtr pctxt,
* declaration}'s {value constraint} .
*/
xmlSchemaGetEffectiveValueConstraint(base->attr,
&effFixed, &bEffValue, 0);
&effFixed, &bEffValue, NULL);
/*
* 2.1.3 ... one of the following must be true
*
......@@ -12839,7 +12839,7 @@ xmlSchemaBuildAttributeValidation(xmlSchemaParserCtxtPtr pctxt,
const xmlChar *rEffValue = NULL;
xmlSchemaGetEffectiveValueConstraint(base->attr,
&effFixed, &rEffValue, 0);
&effFixed, &rEffValue, NULL);
/*
* 2.1.3.2 R's effective value constraint is
* fixed with the same string as B's.
......
......@@ -89,7 +89,7 @@
double xmlXPathNAN = 0;
double xmlXPathPINF = 1;
double xmlXPathNINF = -1;
double xmlXPathNZERO = 0;
static double xmlXPathNZERO = 0; /* not exported from headers */
static int xmlXPathInitialized = 0;
/**
......@@ -189,6 +189,15 @@ static int xmlXPathDisableOptimizer = 0;
* *
************************************************************************/
/**
* XP_ERRORNULL:
* @X: the error code
*
* Macro to raise an XPath error and return NULL.
*/
#define XP_ERRORNULL(X) \
{ xmlXPathErr(ctxt, X); return(NULL); }
/*
* The array xmlXPathErrorMessages corresponds to the enum xmlXPathError
*/
......@@ -1116,20 +1125,20 @@ xmlXPathDebugDumpCompExpr(FILE *output, xmlXPathCompExprPtr comp,
*
* Returns the XPath object just removed
*/
extern xmlXPathObjectPtr
xmlXPathObjectPtr
valuePop(xmlXPathParserContextPtr ctxt)
{
xmlXPathObjectPtr ret;
if ((ctxt == NULL) || (ctxt->valueNr <= 0))
return (0);
return (NULL);
ctxt->valueNr--;
if (ctxt->valueNr > 0)
ctxt->value = ctxt->valueTab[ctxt->valueNr - 1];
else
ctxt->value = NULL;
ret = ctxt->valueTab[ctxt->valueNr];
ctxt->valueTab[ctxt->valueNr] = 0;
ctxt->valueTab[ctxt->valueNr] = NULL;
return (ret);
}
/**
......@@ -1141,7 +1150,7 @@ valuePop(xmlXPathParserContextPtr ctxt)
*
* returns the number of items on the value stack
*/
extern int
int
valuePush(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value)
{
if ((ctxt == NULL) || (value == NULL)) return(-1);
......@@ -7574,7 +7583,7 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) {
buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar));
if (buffer == NULL) {
XP_ERROR0(XPATH_MEMORY_ERROR);
XP_ERRORNULL(XPATH_MEMORY_ERROR);
}
memcpy(buffer, buf, len);
while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigname.xml */
......@@ -7587,7 +7596,7 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) {
buffer = (xmlChar *) xmlRealloc(buffer,
max * sizeof(xmlChar));
if (buffer == NULL) {
XP_ERROR0(XPATH_MEMORY_ERROR);
XP_ERRORNULL(XPATH_MEMORY_ERROR);
}
}
COPY_BUF(l,buffer,len,c);
......@@ -7823,7 +7832,7 @@ xmlXPathParseLiteral(xmlXPathParserContextPtr ctxt) {
while ((IS_CHAR_CH(CUR)) && (CUR != '"'))
NEXT;
if (!IS_CHAR_CH(CUR)) {
XP_ERROR0(XPATH_UNFINISHED_LITERAL_ERROR);
XP_ERRORNULL(XPATH_UNFINISHED_LITERAL_ERROR);
} else {
ret = xmlStrndup(q, CUR_PTR - q);
NEXT;
......@@ -7834,13 +7843,13 @@ xmlXPathParseLiteral(xmlXPathParserContextPtr ctxt) {
while ((IS_CHAR_CH(CUR)) && (CUR != '\''))
NEXT;
if (!IS_CHAR_CH(CUR)) {
XP_ERROR0(XPATH_UNFINISHED_LITERAL_ERROR);
XP_ERRORNULL(XPATH_UNFINISHED_LITERAL_ERROR);
} else {
ret = xmlStrndup(q, CUR_PTR - q);
NEXT;
}
} else {
XP_ERROR0(XPATH_START_LITERAL_ERROR);
XP_ERRORNULL(XPATH_START_LITERAL_ERROR);
}
return(ret);
}
......@@ -8650,7 +8659,7 @@ xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test,
if (name == NULL)
name = xmlXPathParseNCName(ctxt);
if (name == NULL) {
XP_ERROR0(XPATH_EXPR_ERROR);
XP_ERRORNULL(XPATH_EXPR_ERROR);
}
blanks = IS_BLANK_CH(CUR);
......@@ -8671,7 +8680,7 @@ xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test,
else {
if (name != NULL)
xmlFree(name);
XP_ERROR0(XPATH_EXPR_ERROR);
XP_ERRORNULL(XPATH_EXPR_ERROR);
}
*test = NODE_TEST_TYPE;
......@@ -8686,7 +8695,7 @@ xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test,
name = NULL;
if (CUR != ')') {
name = xmlXPathParseLiteral(ctxt);
CHECK_ERROR 0;
CHECK_ERROR NULL;
*test = NODE_TEST_PI;
SKIP_BLANKS;
}
......@@ -8694,7 +8703,7 @@ xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test,
if (CUR != ')') {
if (name != NULL)
xmlFree(name);
XP_ERROR0(XPATH_UNCLOSED_ERROR);
XP_ERRORNULL(XPATH_UNCLOSED_ERROR);
}
NEXT;
return(name);
......@@ -8732,7 +8741,7 @@ xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test,
name = xmlXPathParseNCName(ctxt);
if (name == NULL) {
XP_ERROR0(XPATH_EXPR_ERROR);
XP_ERRORNULL(XPATH_EXPR_ERROR);
}
}
return(name);
......@@ -11390,7 +11399,7 @@ xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) {
if( pctxt->error != XPATH_EXPRESSION_OK )
{
xmlXPathFreeParserContext(pctxt);
return (0);
return(NULL);
}
if (*pctxt->cur != 0) {
......
......@@ -2412,7 +2412,7 @@ xmlXPtrAdvanceChar(xmlNodePtr *node, int *indx, int bytes) {
if (pos + bytes >= len) {
bytes -= (len - pos);
cur = xmlXPtrAdvanceNode(cur, NULL);
cur = 0;
pos = 0;
} else if (pos + bytes < len) {
pos += bytes;
*node = cur;
......
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