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:
@@ -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>
|
Fri Nov 12 16:12:48 CET 2004 Kasimier Buchcik <libxml2-cvs@cazic.net>
|
||||||
|
|
||||||
* xmlschemas.c: Un-commented a TODO in xmlSchemaParseElement.
|
* xmlschemas.c: Un-commented a TODO in xmlSchemaParseElement.
|
||||||
|
35
gentest.py
35
gentest.py
@@ -628,7 +628,12 @@ def generate_test(module, node):
|
|||||||
if is_known_param_type(type, rtype) == 0:
|
if is_known_param_type(type, rtype) == 0:
|
||||||
add_missing_type(type, name);
|
add_missing_type(type, name);
|
||||||
no_gen = 1
|
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:
|
try:
|
||||||
rets = node.xpathEval("return")
|
rets = node.xpathEval("return")
|
||||||
@@ -688,12 +693,7 @@ test_%s(void) {
|
|||||||
|
|
||||||
# Declare the arguments
|
# Declare the arguments
|
||||||
for arg in t_args:
|
for arg in t_args:
|
||||||
(nam, type, rtype, info) = arg;
|
(nam, type, rtype, crtype, info) = arg;
|
||||||
if (type[-3:] == 'Ptr' or type[-4:] == '_ptr') and \
|
|
||||||
rtype[0:6] == 'const ':
|
|
||||||
crtype = rtype[6:]
|
|
||||||
else:
|
|
||||||
crtype = rtype
|
|
||||||
# add declaration
|
# add declaration
|
||||||
test.write(" %s %s; /* %s */\n" % (crtype, nam, info))
|
test.write(" %s %s; /* %s */\n" % (crtype, nam, info))
|
||||||
test.write(" int n_%s;\n" % (nam))
|
test.write(" int n_%s;\n" % (nam))
|
||||||
@@ -701,7 +701,7 @@ test_%s(void) {
|
|||||||
|
|
||||||
# Cascade loop on of each argument list of values
|
# Cascade loop on of each argument list of values
|
||||||
for arg in t_args:
|
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" % (
|
test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % (
|
||||||
nam, nam, type, nam))
|
nam, nam, type, nam))
|
||||||
@@ -713,7 +713,7 @@ test_%s(void) {
|
|||||||
# prepare the call
|
# prepare the call
|
||||||
i = 0;
|
i = 0;
|
||||||
for arg in t_args:
|
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))
|
test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i))
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
@@ -725,11 +725,13 @@ test_%s(void) {
|
|||||||
test.write("\n ret_val = %s(" % (name))
|
test.write("\n ret_val = %s(" % (name))
|
||||||
need = 0
|
need = 0
|
||||||
for arg in t_args:
|
for arg in t_args:
|
||||||
(nam, type, rtype, info) = arg
|
(nam, type, rtype, crtype, info) = arg
|
||||||
if need:
|
if need:
|
||||||
test.write(", ")
|
test.write(", ")
|
||||||
else:
|
else:
|
||||||
need = 1
|
need = 1
|
||||||
|
if rtype != crtype:
|
||||||
|
test.write("(%s)" % rtype)
|
||||||
test.write("%s" % nam);
|
test.write("%s" % nam);
|
||||||
test.write(");\n")
|
test.write(");\n")
|
||||||
if extra_post_call.has_key(name):
|
if extra_post_call.has_key(name):
|
||||||
@@ -739,11 +741,13 @@ test_%s(void) {
|
|||||||
test.write("\n %s(" % (name));
|
test.write("\n %s(" % (name));
|
||||||
need = 0;
|
need = 0;
|
||||||
for arg in t_args:
|
for arg in t_args:
|
||||||
(nam, type, rtype, info) = arg;
|
(nam, type, rtype, crtype, info) = arg;
|
||||||
if need:
|
if need:
|
||||||
test.write(", ")
|
test.write(", ")
|
||||||
else:
|
else:
|
||||||
need = 1
|
need = 1
|
||||||
|
if rtype != crtype:
|
||||||
|
test.write("(%s)" % rtype)
|
||||||
test.write("%s" % nam)
|
test.write("%s" % nam)
|
||||||
test.write(");\n")
|
test.write(");\n")
|
||||||
if extra_post_call.has_key(name):
|
if extra_post_call.has_key(name):
|
||||||
@@ -754,9 +758,12 @@ test_%s(void) {
|
|||||||
# Free the arguments
|
# Free the arguments
|
||||||
i = 0;
|
i = 0;
|
||||||
for arg in t_args:
|
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;
|
i = i + 1;
|
||||||
|
|
||||||
test.write(" xmlResetLastError();\n");
|
test.write(" xmlResetLastError();\n");
|
||||||
@@ -768,7 +775,7 @@ test_%s(void) {
|
|||||||
test_ret++;
|
test_ret++;
|
||||||
""" % (name));
|
""" % (name));
|
||||||
for arg in t_args:
|
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(" %%d", n_%s);\n""" % (nam))
|
||||||
test.write(""" printf("\\n");\n""")
|
test.write(""" printf("\\n");\n""")
|
||||||
test.write(" }\n")
|
test.write(" }\n")
|
||||||
|
24
xpath.c
24
xpath.c
@@ -3931,9 +3931,13 @@ xmlXPathFreeContext(xmlXPathContextPtr ctxt) {
|
|||||||
|
|
||||||
#define CHECK_CTXT(ctxt) \
|
#define CHECK_CTXT(ctxt) \
|
||||||
if (ctxt == NULL) { \
|
if (ctxt == NULL) { \
|
||||||
xmlGenericError(xmlGenericErrorContext, \
|
__xmlRaiseError(NULL, NULL, NULL, \
|
||||||
"%s:%d Internal error: ctxt == NULL\n", \
|
NULL, NULL, XML_FROM_XPATH, \
|
||||||
__FILE__, __LINE__); \
|
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;
|
static int reentance = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((comp == NULL) || (ctx == NULL))
|
CHECK_CTXT(ctx)
|
||||||
|
|
||||||
|
if (comp == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
xmlXPathInit();
|
xmlXPathInit();
|
||||||
|
|
||||||
CHECK_CONTEXT(ctx)
|
|
||||||
|
|
||||||
#ifndef LIBXML_THREAD_ENABLED
|
#ifndef LIBXML_THREAD_ENABLED
|
||||||
reentance++;
|
reentance++;
|
||||||
if (reentance > 1)
|
if (reentance > 1)
|
||||||
@@ -11194,9 +11198,9 @@ xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) {
|
|||||||
xmlXPathObjectPtr res, tmp, init = NULL;
|
xmlXPathObjectPtr res, tmp, init = NULL;
|
||||||
int stack = 0;
|
int stack = 0;
|
||||||
|
|
||||||
xmlXPathInit();
|
CHECK_CTXT(ctx)
|
||||||
|
|
||||||
CHECK_CONTEXT(ctx)
|
xmlXPathInit();
|
||||||
|
|
||||||
ctxt = xmlXPathNewParserContext(str, ctx);
|
ctxt = xmlXPathNewParserContext(str, ctx);
|
||||||
xmlXPathEvalExpr(ctxt);
|
xmlXPathEvalExpr(ctxt);
|
||||||
@@ -11250,9 +11254,9 @@ xmlXPathEvalExpression(const xmlChar *str, xmlXPathContextPtr ctxt) {
|
|||||||
xmlXPathObjectPtr res, tmp;
|
xmlXPathObjectPtr res, tmp;
|
||||||
int stack = 0;
|
int stack = 0;
|
||||||
|
|
||||||
xmlXPathInit();
|
CHECK_CTXT(ctxt)
|
||||||
|
|
||||||
CHECK_CONTEXT(ctxt)
|
xmlXPathInit();
|
||||||
|
|
||||||
pctxt = xmlXPathNewParserContext(str, ctxt);
|
pctxt = xmlXPathNewParserContext(str, ctxt);
|
||||||
xmlXPathEvalExpr(pctxt);
|
xmlXPathEvalExpr(pctxt);
|
||||||
|
Reference in New Issue
Block a user