1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

more coverage more fixes Daniel

* gentest.py testapi.c: more coverage
* debugXML.c parser.c xmlregexp.c xpath.c: more fixes
Daniel
This commit is contained in:
Daniel Veillard 2004-11-08 16:24:57 +00:00
parent 2a4fb5ac07
commit a82b182655
8 changed files with 6021 additions and 52 deletions

View File

@ -1,3 +1,8 @@
Mon Nov 8 17:25:27 CET 2004 Daniel Veillard <daniel@veillard.com>
* gentest.py testapi.c: more coverage
* debugXML.c parser.c xmlregexp.c xpath.c: more fixes
Mon Nov 8 15:02:39 CET 2004 Daniel Veillard <daniel@veillard.com>
* gentest.py testapi.c: more coverage

View File

@ -1151,6 +1151,7 @@ xmlCtxtDumpDocHead(xmlDebugCtxtPtr ctxt, xmlDocPtr doc)
static void
xmlCtxtDumpDocumentHead(xmlDebugCtxtPtr ctxt, xmlDocPtr doc)
{
if (doc == NULL) return;
xmlCtxtDumpDocHead(ctxt, doc);
if (!ctxt->check) {
if (doc->name != NULL) {
@ -1258,6 +1259,7 @@ xmlCtxtDumpEntityCallback(xmlEntityPtr cur, xmlDebugCtxtPtr ctxt)
static void
xmlCtxtDumpEntities(xmlDebugCtxtPtr ctxt, xmlDocPtr doc)
{
if (doc == NULL) return;
xmlCtxtDumpDocHead(ctxt, doc);
if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) {
xmlEntitiesTablePtr table = (xmlEntitiesTablePtr)
@ -1354,6 +1356,7 @@ void
xmlDebugDumpAttr(FILE *output, xmlAttrPtr attr, int depth) {
xmlDebugCtxt ctxt;
if (output == NULL) return;
xmlCtxtDumpInitCtxt(&ctxt);
ctxt.output = output;
ctxt.depth = depth;
@ -1374,6 +1377,7 @@ xmlDebugDumpEntities(FILE * output, xmlDocPtr doc)
{
xmlDebugCtxt ctxt;
if (output == NULL) return;
xmlCtxtDumpInitCtxt(&ctxt);
ctxt.output = output;
xmlCtxtDumpEntities(&ctxt, doc);
@ -1393,6 +1397,7 @@ xmlDebugDumpAttrList(FILE * output, xmlAttrPtr attr, int depth)
{
xmlDebugCtxt ctxt;
if (output == NULL) return;
xmlCtxtDumpInitCtxt(&ctxt);
ctxt.output = output;
ctxt.depth = depth;
@ -1413,6 +1418,7 @@ xmlDebugDumpOneNode(FILE * output, xmlNodePtr node, int depth)
{
xmlDebugCtxt ctxt;
if (output == NULL) return;
xmlCtxtDumpInitCtxt(&ctxt);
ctxt.output = output;
ctxt.depth = depth;
@ -1628,6 +1634,7 @@ xmlLsCountNode(xmlNodePtr node) {
*/
void
xmlLsOneNode(FILE *output, xmlNodePtr node) {
if (output == NULL) return;
if (node == NULL) {
fprintf(output, "NULL\n");
return;
@ -1834,9 +1841,11 @@ xmlShellPrintXPathError(int errorType, const char *arg)
"%s is an XSLT value tree\n", arg);
break;
}
#if 0
xmlGenericError(xmlGenericErrorContext,
"Try casting the result string function (xpath builtin)\n",
arg);
#endif
}
@ -2391,6 +2400,7 @@ xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename,
xmlDocPtr doc;
int html = 0;
if ((ctxt == NULL) || (filename == NULL)) return(-1);
if (ctxt->doc != NULL)
html = (ctxt->doc->type == XML_HTML_DOCUMENT_NODE);
@ -2445,8 +2455,6 @@ xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
if (node == NULL)
return (-1);
if ((filename == NULL) || (filename[0] == 0)) {
xmlGenericError(xmlGenericErrorContext,
"Write command requires a filename argument\n");
return (-1);
}
#ifdef W_OK
@ -2512,10 +2520,12 @@ xmlShellSave(xmlShellCtxtPtr ctxt, char *filename,
xmlNodePtr node ATTRIBUTE_UNUSED,
xmlNodePtr node2 ATTRIBUTE_UNUSED)
{
if (ctxt->doc == NULL)
if ((ctxt == NULL) || (ctxt->doc == NULL))
return (-1);
if ((filename == NULL) || (filename[0] == 0))
filename = ctxt->filename;
if (filename == NULL)
return (-1);
#ifdef W_OK
if (access((char *) filename, W_OK)) {
xmlGenericError(xmlGenericErrorContext,
@ -2575,6 +2585,7 @@ xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd,
xmlValidCtxt vctxt;
int res = -1;
if ((ctxt == NULL) || (ctxt->doc == NULL)) return(-1);
vctxt.userData = stderr;
vctxt.error = (xmlValidityErrorFunc) fprintf;
vctxt.warning = (xmlValidityWarningFunc) fprintf;
@ -2697,7 +2708,7 @@ xmlShellPwd(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *buffer,
{
xmlChar *path;
if (node == NULL)
if ((node == NULL) || (buffer == NULL))
return (-1);
path = xmlGetNodePath(node);
@ -2873,7 +2884,11 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
} else if (!strcmp(command, "save")) {
xmlShellSave(ctxt, arg, NULL, NULL);
} else if (!strcmp(command, "write")) {
xmlShellWrite(ctxt, arg, NULL, NULL);
if ((arg == NULL) || (arg[0] == 0))
xmlGenericError(xmlGenericErrorContext,
"Write command requires a filename argument\n");
else
xmlShellWrite(ctxt, arg, NULL, NULL);
#endif /* LIBXML_OUTPUT_ENABLED */
} else if (!strcmp(command, "grep")) {
xmlShellGrep(ctxt, arg, ctxt->node, NULL);

View File

@ -15,12 +15,9 @@ except:
# Modules we don't want skip in API test
#
skipped_modules = [ "SAX", "xlink", "threads", "globals",
"xpathInternals", "xmlmemory",
"xmlversion", "debugXML", "xmlexports", "DOCBparser",
# temporary
"xmlautomata", "xmlregexp", "c14n",
"xmlmemory", "xmlversion", "xmlexports",
#deprecated
"DOCBparser",
]
#
@ -46,6 +43,7 @@ skipped_functions = [
"xmlSetTreeDoc", "xmlUnlinkNode",
# hard to avoid leaks in the tests
"xmlStrcat", "xmlStrncat", "xmlCatalogAddLocal", "xmlNewTextWriterDoc",
"xmlXPathNewValueTree", "xmlXPathWrapString",
# unimplemented
"xmlTextReaderReadInnerXml", "xmlTextReaderReadOuterXml",
"xmlTextReaderReadString",
@ -57,10 +55,11 @@ skipped_functions = [
"xmlNamespaceParseNSDef", "xmlNamespaceParseQName",
"xmlParseNamespace", "xmlParseQuotedString", "xmlParserHandleReference",
"xmlScanName",
"xmlDecodeEntities",
# allocators
"xmlMemFree",
# verbosity
"xmlCatalogSetDebug",
"xmlCatalogSetDebug", "xmlShellPrintXPathError", "xmlShellPrintNode",
# Internal functions, no user space should really call them
"xmlParseAttribute", "xmlParseAttributeListDecl", "xmlParseName",
"xmlParseNmtoken", "xmlParseEntityValue", "xmlParseAttValue",
@ -277,6 +276,8 @@ def type_convert(str, name, info, module, function, pos):
res = 'const_xmlChar_ptr_ptr'
if res == 'const_char_ptr*':
res = 'const_char_ptr_ptr'
if res == 'FILE_ptr' and module == 'debugXML':
res = 'debug_FILE_ptr';
return res

View File

@ -40,7 +40,7 @@ extern "C" {
*/
#define xmlXPathSetError(ctxt, err) \
{ xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \
(ctxt)->error = (err); }
if ((ctxt) != NULL) (ctxt)->error = (err); }
/**
* xmlXPathSetArityError:
@ -294,6 +294,7 @@ XMLPUBFUN void * XMLCALL
* Macro to check that the number of args passed to an XPath function matches.
*/
#define CHECK_ARITY(x) \
if (ctxt == NULL) return; \
if (nargs != (x)) \
XP_ERROR(XPATH_INVALID_ARITY);

View File

@ -1420,7 +1420,7 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
*/
xmlChar
xmlPopInput(xmlParserCtxtPtr ctxt) {
if (ctxt->inputNr <= 1) return(0); /* End of main Input */
if ((ctxt == NULL) || (ctxt->inputNr <= 1)) return(0);
if (xmlParserDebugEntities)
xmlGenericError(xmlGenericErrorContext,
"Popping input %d\n", ctxt->inputNr);
@ -1934,7 +1934,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
int c,l;
int nbchars = 0;
if ((str == NULL) || (len < 0))
if ((ctxt == NULL) || (str == NULL) || (len < 0))
return(NULL);
last = str + len;
@ -2076,6 +2076,7 @@ mem_error:
xmlChar *
xmlStringDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int what,
xmlChar end, xmlChar end2, xmlChar end3) {
if ((ctxt == NULL) || (str == NULL)) return(NULL);
return(xmlStringLenDecodeEntities(ctxt, str, xmlStrlen(str), what,
end, end2, end3));
}

5968
testapi.c

File diff suppressed because it is too large Load Diff

View File

@ -4062,6 +4062,8 @@ void
xmlRegexpPrint(FILE *output, xmlRegexpPtr regexp) {
int i;
if (output == NULL)
return;
fprintf(output, " regexp: ");
if (regexp == NULL) {
fprintf(output, "NULL\n");

50
xpath.c
View File

@ -775,6 +775,8 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) {
int i;
char shift[100];
if (output == NULL) return;
for (i = 0;((i < depth) && (i < 25));i++)
shift[2 * i] = shift[2 * i + 1] = ' ';
shift[2 * i] = shift[2 * i + 1] = 0;
@ -1063,6 +1065,8 @@ xmlXPathDebugDumpCompExpr(FILE *output, xmlXPathCompExprPtr comp,
int i;
char shift[100];
if ((output == NULL) || (comp == NULL)) return;
for (i = 0;((i < depth) && (i < 25));i++)
shift[2 * i] = shift[2 * i + 1] = ' ';
shift[2 * i] = shift[2 * i + 1] = 0;
@ -1099,7 +1103,7 @@ valuePop(xmlXPathParserContextPtr ctxt)
{
xmlXPathObjectPtr ret;
if (ctxt->valueNr <= 0)
if ((ctxt == NULL) || (ctxt->valueNr <= 0))
return (0);
ctxt->valueNr--;
if (ctxt->valueNr > 0)
@ -1122,6 +1126,7 @@ valuePop(xmlXPathParserContextPtr ctxt)
extern int
valuePush(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value)
{
if ((ctxt == NULL) || (value == NULL)) return(-1);
if (ctxt->valueNr >= ctxt->valueMax) {
xmlXPathObjectPtr *tmp;
@ -1268,7 +1273,7 @@ xmlXPathPopExternal (xmlXPathParserContextPtr ctxt) {
xmlXPathObjectPtr obj;
void * ret;
if (ctxt->value == NULL) {
if ((ctxt == NULL) || (ctxt->value == NULL)) {
xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND);
return(NULL);
}
@ -1803,6 +1808,7 @@ int
xmlXPathNodeSetContains (xmlNodeSetPtr cur, xmlNodePtr val) {
int i;
if ((cur == NULL) || (val == NULL)) return(0);
if (val->type == XML_NAMESPACE_DECL) {
for (i = 0; i < cur->nodeNr; i++) {
if (cur->nodeTab[i]->type == XML_NAMESPACE_DECL) {
@ -1838,7 +1844,9 @@ void
xmlXPathNodeSetAddNs(xmlNodeSetPtr cur, xmlNodePtr node, xmlNsPtr ns) {
int i;
if ((ns == NULL) || (node == NULL) || (ns->type != XML_NAMESPACE_DECL) ||
if ((cur == NULL) || (ns == NULL) || (node == NULL) ||
(ns->type != XML_NAMESPACE_DECL) ||
(node->type != XML_ELEMENT_NODE))
return;
@ -1893,7 +1901,7 @@ void
xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) {
int i;
if (val == NULL) return;
if ((cur == NULL) || (val == NULL)) return;
#if 0
if ((val->type == XML_ELEMENT_NODE) && (val->name[0] == ' '))
@ -1951,7 +1959,7 @@ xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) {
*/
void
xmlXPathNodeSetAddUnique(xmlNodeSetPtr cur, xmlNodePtr val) {
if (val == NULL) return;
if ((cur == NULL) || (val == NULL)) return;
#if 0
if ((val->type == XML_ELEMENT_NODE) && (val->name[0] == ' '))
@ -4859,6 +4867,7 @@ xmlXPathEqualValues(xmlXPathParserContextPtr ctxt) {
xmlXPathObjectPtr arg1, arg2, argtmp;
int ret = 0;
if ((ctxt == NULL) || (ctxt->context == NULL)) return;
arg2 = valuePop(ctxt);
arg1 = valuePop(ctxt);
if ((arg1 == NULL) || (arg2 == NULL)) {
@ -4942,6 +4951,7 @@ xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt) {
xmlXPathObjectPtr arg1, arg2, argtmp;
int ret = 0;
if ((ctxt == NULL) || (ctxt->context == NULL)) return;
arg2 = valuePop(ctxt);
arg1 = valuePop(ctxt);
if ((arg1 == NULL) || (arg2 == NULL)) {
@ -5041,6 +5051,7 @@ xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict) {
int ret = 0, arg1i = 0, arg2i = 0;
xmlXPathObjectPtr arg1, arg2;
if ((ctxt == NULL) || (ctxt->context == NULL)) return;
arg2 = valuePop(ctxt);
arg1 = valuePop(ctxt);
if ((arg1 == NULL) || (arg2 == NULL)) {
@ -5152,6 +5163,7 @@ xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict) {
*/
void
xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return;
CAST_TO_NUMBER;
CHECK_TYPE(XPATH_NUMBER);
if (xmlXPathIsNaN(ctxt->value->floatval))
@ -5339,6 +5351,7 @@ typedef xmlNodePtr (*xmlXPathTraversalFunction)
*/
xmlNodePtr
xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if (cur == NULL)
return(ctxt->context->node);
return(NULL);
@ -5356,6 +5369,7 @@ xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
*/
xmlNodePtr
xmlXPathNextChild(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if (cur == NULL) {
if (ctxt->context->node == NULL) return(NULL);
switch (ctxt->context->node->type) {
@ -5407,6 +5421,7 @@ xmlXPathNextChild(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
*/
xmlNodePtr
xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if (cur == NULL) {
if (ctxt->context->node == NULL)
return(NULL);
@ -5469,6 +5484,7 @@ xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
*/
xmlNodePtr
xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if (cur == NULL) {
if (ctxt->context->node == NULL)
return(NULL);
@ -5493,6 +5509,7 @@ xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
*/
xmlNodePtr
xmlXPathNextParent(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
/*
* the parent of an attribute or namespace node is the element
* to which the attribute or namespace node is attached
@ -5565,6 +5582,7 @@ xmlXPathNextParent(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
*/
xmlNodePtr
xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
/*
* the parent of an attribute or namespace node is the element
* to which the attribute or namespace node is attached
@ -5688,6 +5706,7 @@ xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
*/
xmlNodePtr
xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if (cur == NULL)
return(ctxt->context->node);
return(xmlXPathNextAncestor(ctxt, cur));
@ -5706,6 +5725,7 @@ xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
*/
xmlNodePtr
xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
(ctxt->context->node->type == XML_NAMESPACE_DECL))
return(NULL);
@ -5730,6 +5750,7 @@ xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
*/
xmlNodePtr
xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
(ctxt->context->node->type == XML_NAMESPACE_DECL))
return(NULL);
@ -5760,6 +5781,7 @@ xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
*/
xmlNodePtr
xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if (cur != NULL && cur->children != NULL)
return cur->children ;
if (cur == NULL) cur = ctxt->context->node;
@ -5815,6 +5837,7 @@ xmlXPathIsAncestor(xmlNodePtr ancestor, xmlNodePtr node) {
xmlNodePtr
xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur)
{
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if (cur == NULL)
cur = ctxt->context->node;
if (cur == NULL)
@ -5855,6 +5878,7 @@ static xmlNodePtr
xmlXPathNextPrecedingInternal(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur)
{
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if (cur == NULL) {
cur = ctxt->context->node;
if (cur == NULL)
@ -5897,6 +5921,7 @@ xmlXPathNextPrecedingInternal(xmlXPathParserContextPtr ctxt,
*/
xmlNodePtr
xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if (ctxt->context->node->type != XML_ELEMENT_NODE) return(NULL);
if (ctxt->context->tmpNsList == NULL && cur != (xmlNodePtr) xmlXPathXMLNamespace) {
if (ctxt->context->tmpNsList != NULL)
@ -5933,6 +5958,7 @@ xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
*/
xmlNodePtr
xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if (ctxt->context->node == NULL)
return(NULL);
if (ctxt->context->node->type != XML_ELEMENT_NODE)
@ -5968,6 +5994,7 @@ xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
*/
void
xmlXPathRoot(xmlXPathParserContextPtr ctxt) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return;
ctxt->context->node = (xmlNodePtr) ctxt->context->doc;
valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node));
}
@ -6204,6 +6231,8 @@ void
xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr cur;
if (ctxt == NULL) return;
if (nargs == 0) {
valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node));
nargs = 1;
@ -6259,6 +6288,8 @@ void
xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr cur;
if (ctxt == NULL) return;
if (nargs == 0) {
valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node));
nargs = 1;
@ -6408,6 +6439,7 @@ void
xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr cur;
if (ctxt == NULL) return;
if (nargs == 0) {
valuePush(ctxt,
xmlXPathWrapString(
@ -6439,6 +6471,8 @@ xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr cur;
if (nargs == 0) {
if ((ctxt == NULL) || (ctxt->context == NULL))
return;
if (ctxt->context->node == NULL) {
valuePush(ctxt, xmlXPathNewFloat(0));
} else {
@ -6472,6 +6506,7 @@ xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr cur, newobj;
xmlChar *tmp;
if (ctxt == NULL) return;
if (nargs < 2) {
CHECK_ARITY(2);
}
@ -6803,6 +6838,7 @@ xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
xmlBufferPtr target;
xmlChar blank;
if (ctxt == NULL) return;
if (nargs == 0) {
/* Use current context node */
valuePush(ctxt,
@ -7058,6 +7094,7 @@ xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr cur;
double res;
if (ctxt == NULL) return;
if (nargs == 0) {
if (ctxt->context->node == NULL) {
valuePush(ctxt, xmlXPathNewFloat(0.0));
@ -7335,6 +7372,7 @@ xmlXPathParseNCName(xmlXPathParserContextPtr ctxt) {
xmlChar *ret;
int count = 0;
if ((ctxt == NULL) || (ctxt->cur == NULL)) return(NULL);
/*
* Accelerator for simple ASCII names
*/
@ -7415,6 +7453,7 @@ xmlXPathParseName(xmlXPathParserContextPtr ctxt) {
xmlChar *ret;
int count = 0;
if ((ctxt == NULL) || (ctxt->cur == NULL)) return(NULL);
/*
* Accelerator for simple ASCII names
*/
@ -11128,6 +11167,7 @@ xmlXPathCompiledEval(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctx) {
*/
void
xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) {
if (ctxt == NULL) return;
xmlXPathCompileExpr(ctxt);
CHECK_ERROR;
xmlXPathRunEval(ctxt);