1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-23 01:52:48 +03:00

trivial change (changed CHECK_CONTEXT to CHECK_CTXT on a couple of lines)

* xpath.c: trivial change (changed CHECK_CONTEXT to CHECK_CTXT
  on a couple of lines)
* gentest.py, testapi.c: enhanced to reduce compilation warnings
This commit is contained in:
William M. Brack
2004-11-12 16:03:48 +00:00
parent 48307f432a
commit f13f77f0e6
4 changed files with 952 additions and 929 deletions

View File

@@ -1,3 +1,9 @@
Fri Nov 12 23:58:14 HKT 2004 William Brack <wbrack@mmm.com.hk>
* xpath.c: trivial change (changed CHECK_CONTEXT to CHECK_CTXT
on a couple of lines)
* gentest.py, testapi.c: enhanced to reduce compilation warnings
Fri Nov 12 16:12:48 CET 2004 Kasimier Buchcik <libxml2-cvs@cazic.net>
* xmlschemas.c: Un-commented a TODO in xmlSchemaParseElement.

View File

@@ -628,7 +628,12 @@ def generate_test(module, node):
if is_known_param_type(type, rtype) == 0:
add_missing_type(type, name);
no_gen = 1
t_args.append((nam, type, rtype, info))
if (type[-3:] == 'Ptr' or type[-4:] == '_ptr') and \
rtype[0:6] == 'const ':
crtype = rtype[6:]
else:
crtype = rtype
t_args.append((nam, type, rtype, crtype, info))
try:
rets = node.xpathEval("return")
@@ -688,12 +693,7 @@ test_%s(void) {
# Declare the arguments
for arg in t_args:
(nam, type, rtype, info) = arg;
if (type[-3:] == 'Ptr' or type[-4:] == '_ptr') and \
rtype[0:6] == 'const ':
crtype = rtype[6:]
else:
crtype = rtype
(nam, type, rtype, crtype, info) = arg;
# add declaration
test.write(" %s %s; /* %s */\n" % (crtype, nam, info))
test.write(" int n_%s;\n" % (nam))
@@ -701,7 +701,7 @@ test_%s(void) {
# Cascade loop on of each argument list of values
for arg in t_args:
(nam, type, rtype, info) = arg;
(nam, type, rtype, crtype, info) = arg;
#
test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % (
nam, nam, type, nam))
@@ -713,7 +713,7 @@ test_%s(void) {
# prepare the call
i = 0;
for arg in t_args:
(nam, type, rtype, info) = arg;
(nam, type, rtype, crtype, info) = arg;
#
test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i))
i = i + 1;
@@ -725,11 +725,13 @@ test_%s(void) {
test.write("\n ret_val = %s(" % (name))
need = 0
for arg in t_args:
(nam, type, rtype, info) = arg
(nam, type, rtype, crtype, info) = arg
if need:
test.write(", ")
else:
need = 1
if rtype != crtype:
test.write("(%s)" % rtype)
test.write("%s" % nam);
test.write(");\n")
if extra_post_call.has_key(name):
@@ -739,11 +741,13 @@ test_%s(void) {
test.write("\n %s(" % (name));
need = 0;
for arg in t_args:
(nam, type, rtype, info) = arg;
(nam, type, rtype, crtype, info) = arg;
if need:
test.write(", ")
else:
need = 1
if rtype != crtype:
test.write("(%s)" % rtype)
test.write("%s" % nam)
test.write(");\n")
if extra_post_call.has_key(name):
@@ -754,9 +758,12 @@ test_%s(void) {
# Free the arguments
i = 0;
for arg in t_args:
(nam, type, rtype, info) = arg;
(nam, type, rtype, crtype, info) = arg;
#
test.write(" des_%s(n_%s, %s, %d);\n" % (type, nam, nam, i))
test.write(" des_%s(n_%s, " % (type, nam))
if rtype != crtype:
test.write("(%s)" % rtype)
test.write("%s, %d);\n" % (nam, i))
i = i + 1;
test.write(" xmlResetLastError();\n");
@@ -768,7 +775,7 @@ test_%s(void) {
test_ret++;
""" % (name));
for arg in t_args:
(nam, type, rtype, info) = arg;
(nam, type, rtype, crtype, info) = arg;
test.write(""" printf(" %%d", n_%s);\n""" % (nam))
test.write(""" printf("\\n");\n""")
test.write(" }\n")

1816
testapi.c

File diff suppressed because it is too large Load Diff

24
xpath.c
View File

@@ -3931,9 +3931,13 @@ xmlXPathFreeContext(xmlXPathContextPtr ctxt) {
#define CHECK_CTXT(ctxt) \
if (ctxt == NULL) { \
xmlGenericError(xmlGenericErrorContext, \
"%s:%d Internal error: ctxt == NULL\n", \
__FILE__, __LINE__); \
__xmlRaiseError(NULL, NULL, NULL, \
NULL, NULL, XML_FROM_XPATH, \
XML_ERR_INTERNAL_ERROR, XML_ERR_FATAL, \
__FILE__, __LINE__, \
NULL, NULL, NULL, 0, 0, \
"NULL context pointer\n"); \
return(NULL); \
} \
@@ -11105,12 +11109,12 @@ xmlXPathCompiledEval(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctx) {
static int reentance = 0;
#endif
if ((comp == NULL) || (ctx == NULL))
CHECK_CTXT(ctx)
if (comp == NULL)
return(NULL);
xmlXPathInit();
CHECK_CONTEXT(ctx)
#ifndef LIBXML_THREAD_ENABLED
reentance++;
if (reentance > 1)
@@ -11194,9 +11198,9 @@ xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) {
xmlXPathObjectPtr res, tmp, init = NULL;
int stack = 0;
xmlXPathInit();
CHECK_CTXT(ctx)
CHECK_CONTEXT(ctx)
xmlXPathInit();
ctxt = xmlXPathNewParserContext(str, ctx);
xmlXPathEvalExpr(ctxt);
@@ -11250,9 +11254,9 @@ xmlXPathEvalExpression(const xmlChar *str, xmlXPathContextPtr ctxt) {
xmlXPathObjectPtr res, tmp;
int stack = 0;
xmlXPathInit();
CHECK_CTXT(ctxt)
CHECK_CONTEXT(ctxt)
xmlXPathInit();
pctxt = xmlXPathNewParserContext(str, ctxt);
xmlXPathEvalExpr(pctxt);