1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-26 00:37:43 +03:00

error: Don't use initGenericErrorDefaultFunc

The code in xmlInitParser did only set the error handler if it was NULL
which should never happen.
This commit is contained in:
Nick Wellnhofer
2022-09-09 01:44:00 +02:00
parent 27c8ba6054
commit a9669679f5
4 changed files with 5 additions and 6 deletions

View File

@@ -81,6 +81,8 @@ xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
* initGenericErrorDefaultFunc: * initGenericErrorDefaultFunc:
* @handler: the handler * @handler: the handler
* *
* DEPRECATED: Use xmlSetGenericErrorFunc.
*
* Set or reset (if NULL) the default handler for generic errors * Set or reset (if NULL) the default handler for generic errors
* to the builtin error function. * to the builtin error function.
*/ */

View File

@@ -864,6 +864,7 @@ typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr erro
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSetGenericErrorFunc (void *ctx, xmlSetGenericErrorFunc (void *ctx,
xmlGenericErrorFunc handler); xmlGenericErrorFunc handler);
XML_DEPRECATED
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler); initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler);

View File

@@ -14725,9 +14725,6 @@ xmlInitParser(void) {
#endif #endif
xmlInitThreads(); xmlInitThreads();
xmlInitGlobals(); xmlInitGlobals();
if ((xmlGenericError == xmlGenericErrorDefaultFunc) ||
(xmlGenericError == NULL))
initGenericErrorDefaultFunc(NULL);
xmlInitMemory(); xmlInitMemory();
xmlInitializeDict(); xmlInitializeDict();
xmlInitCharEncodingHandlers(); xmlInitCharEncodingHandlers();

View File

@@ -2427,12 +2427,11 @@ ignoreGenericError(void *ctx ATTRIBUTE_UNUSED,
static void static void
testXPath(const char *str, int xptr, int expr) { testXPath(const char *str, int xptr, int expr) {
xmlGenericErrorFunc handler = ignoreGenericError;
xmlXPathObjectPtr res; xmlXPathObjectPtr res;
xmlXPathContextPtr ctxt; xmlXPathContextPtr ctxt;
/* Don't print generic errors to stderr. */ /* Don't print generic errors to stderr. */
initGenericErrorDefaultFunc(&handler); xmlSetGenericErrorFunc(NULL, ignoreGenericError);
nb_tests++; nb_tests++;
#if defined(LIBXML_XPTR_ENABLED) #if defined(LIBXML_XPTR_ENABLED)
@@ -2464,7 +2463,7 @@ testXPath(const char *str, int xptr, int expr) {
xmlXPathFreeContext(ctxt); xmlXPathFreeContext(ctxt);
/* Reset generic error handler. */ /* Reset generic error handler. */
initGenericErrorDefaultFunc(NULL); xmlSetGenericErrorFunc(NULL, NULL);
} }
/** /**