From b230861dbd2c79c322d52cabf77941d3f6ce9d14 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Sun, 30 Apr 2023 18:38:16 +0200 Subject: xmlIO: Remove some calls to xmlIOErr The xmlIOErr functions use the global error handler and should be avoided if possible. --- xmlIO.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/xmlIO.c b/xmlIO.c index 658d608f..9fd9c780 100644 --- a/xmlIO.c +++ b/xmlIO.c @@ -211,6 +211,7 @@ __xmlIOWin32UTF8ToWChar(const char *u8String) } #endif +#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) /** * xmlIOErrMemory: * @extra: extra information @@ -222,6 +223,7 @@ xmlIOErrMemory(const char *extra) { __xmlSimpleError(XML_FROM_IO, XML_ERR_NO_MEMORY, NULL, NULL, extra); } +#endif /** * __xmlIOErr: @@ -2325,7 +2327,6 @@ xmlAllocParserInputBuffer(xmlCharEncoding enc) { ret = (xmlParserInputBufferPtr) xmlMalloc(sizeof(xmlParserInputBuffer)); if (ret == NULL) { - xmlIOErrMemory("creating input buffer"); return(NULL); } memset(ret, 0, sizeof(xmlParserInputBuffer)); @@ -2364,7 +2365,6 @@ xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) { ret = (xmlOutputBufferPtr) xmlMalloc(sizeof(xmlOutputBuffer)); if (ret == NULL) { - xmlIOErrMemory("creating output buffer"); return(NULL); } memset(ret, 0, sizeof(xmlOutputBuffer)); @@ -2412,7 +2412,6 @@ xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder) { ret = (xmlOutputBufferPtr) xmlMalloc(sizeof(xmlOutputBuffer)); if (ret == NULL) { - xmlIOErrMemory("creating output buffer"); return(NULL); } memset(ret, 0, sizeof(xmlOutputBuffer)); @@ -4011,7 +4010,7 @@ xmlLoadExternalEntity(const char *URL, const char *ID, canonicFilename = (char *) xmlCanonicPath((const xmlChar *) URL); if (canonicFilename == NULL) { - xmlIOErrMemory("building canonical path\n"); + xmlErrMemory(ctxt, "building canonical path\n"); return(NULL); } -- cgit v1.2.1