postgresql16/postgresql-libxml2.patch

38 lines
2.2 KiB
Diff
Raw Normal View History

Fixes for GCC 14 and libxml2 2.12.0 "error: Make more xmlError structs constant"
xml.c: In function pg_xml_init:
xml.c:1177:52: error: passing argument 2 of xmlSetStructuredErrorFunc from incompatible pointer type [-Wincompatible-pointer-types]
1177 | xmlSetStructuredErrorFunc((void *) errcxt, xml_errorHandler);
| ^~~~~~~~~~~~~~~~
| |
| void (*)(void *, xmlError *) {aka void (*)(void *, struct _xmlError *)}
In file included from /usr/include/libxml2/libxml/valid.h:15,
from /usr/include/libxml2/libxml/parser.h:19,
from xml.c:50:
/usr/include/libxml2/libxml/xmlerror.h:898:57: note: expected xmlStructuredErrorFunc {aka void (*)(void *, const struct _xmlError *)} but argument is of type void (*)(void *, xmlError *) {aka void (*)(void *, struct _xmlError *)}
898 | xmlStructuredErrorFunc handler);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index d3db75eb87..619f908c6d 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -124,7 +124,7 @@ static xmlParserInputPtr xmlPgEntityLoader(const char *URL, const char *ID,
xmlParserCtxtPtr ctxt);
static void xml_errsave(Node *escontext, PgXmlErrorContext *errcxt,
int sqlcode, const char *msg);
-static void xml_errorHandler(void *data, xmlErrorPtr error);
+static void xml_errorHandler(void *data, const xmlError *error);
static int errdetail_for_xml_code(int code);
static void chopStringInfoNewlines(StringInfo str);
static void appendStringInfoLineSeparator(StringInfo str);
@@ -2044,7 +2044,7 @@ xml_errsave(Node *escontext, PgXmlErrorContext *errcxt,
* Error handler for libxml errors and warnings
*/
static void
-xml_errorHandler(void *data, xmlErrorPtr error)
+xml_errorHandler(void *data, const xmlError *error)
{
PgXmlErrorContext *xmlerrcxt = (PgXmlErrorContext *) data;
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) error->ctxt;