diff --git a/error.c b/error.c index 49bd84e0..c96877f4 100644 --- a/error.c +++ b/error.c @@ -81,6 +81,8 @@ xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) { * initGenericErrorDefaultFunc: * @handler: the handler * + * DEPRECATED: Use xmlSetGenericErrorFunc. + * * Set or reset (if NULL) the default handler for generic errors * to the builtin error function. */ diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h index f92b1aee..f8ca8ab8 100644 --- a/include/libxml/xmlerror.h +++ b/include/libxml/xmlerror.h @@ -864,6 +864,7 @@ typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr erro XMLPUBFUN void XMLCALL xmlSetGenericErrorFunc (void *ctx, xmlGenericErrorFunc handler); +XML_DEPRECATED XMLPUBFUN void XMLCALL initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler); diff --git a/parser.c b/parser.c index af0b1171..7bb47366 100644 --- a/parser.c +++ b/parser.c @@ -14725,9 +14725,6 @@ xmlInitParser(void) { #endif xmlInitThreads(); xmlInitGlobals(); - if ((xmlGenericError == xmlGenericErrorDefaultFunc) || - (xmlGenericError == NULL)) - initGenericErrorDefaultFunc(NULL); xmlInitMemory(); xmlInitializeDict(); xmlInitCharEncodingHandlers(); diff --git a/runtest.c b/runtest.c index 791d624d..ff992951 100644 --- a/runtest.c +++ b/runtest.c @@ -2427,12 +2427,11 @@ ignoreGenericError(void *ctx 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); + xmlSetGenericErrorFunc(NULL, ignoreGenericError); nb_tests++; #if defined(LIBXML_XPTR_ENABLED) @@ -2464,7 +2463,7 @@ testXPath(const char *str, int xptr, int expr) { xmlXPathFreeContext(ctxt); /* Reset generic error handler. */ - initGenericErrorDefaultFunc(NULL); + xmlSetGenericErrorFunc(NULL, NULL); } /**