[libxml2] Don't print generic error messages in XPath tests



commit 1fc55ca72b9513f1695a63d0dc4f0a250a079982
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Sat Jun 25 12:35:09 2016 +0200

    Don't print generic error messages in XPath tests

 runtest.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/runtest.c b/runtest.c
index bb74d2a..1861577 100644
--- a/runtest.c
+++ b/runtest.c
@@ -2317,10 +2317,19 @@ static FILE *xpathOutput;
 static xmlDocPtr xpathDocument;
 
 static void
+ignoreGenericError(void *ctx ATTRIBUTE_UNUSED,
+        const char *msg ATTRIBUTE_UNUSED, ...) {
+}
+
+static void
 testXPath(const char *str, int xptr, int expr) {
+    xmlGenericErrorFunc handler = ignoreGenericError;
     xmlXPathObjectPtr res;
     xmlXPathContextPtr ctxt;
 
+    /* Don't print generic errors to stderr. */
+    initGenericErrorDefaultFunc(&handler);
+
     nb_tests++;
 #if defined(LIBXML_XPTR_ENABLED)
     if (xptr) {
@@ -2349,6 +2358,9 @@ testXPath(const char *str, int xptr, int expr) {
     xmlXPathDebugDumpObject(xpathOutput, res, 0);
     xmlXPathFreeObject(res);
     xmlXPathFreeContext(ctxt);
+
+    /* Reset generic error handler. */
+    initGenericErrorDefaultFunc(NULL);
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]