From 5a3b7453cb0a881d6a46a520295ec17df3bcc48c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 18 Aug 2026 10:52:24 +0200 Subject: [PATCH 04/11] Fix some -Wcast-qual warnings [contrib/xml2] Small rearrangement to avoid having to cast away a volatile qualifier. --- contrib/xml2/xslt_proc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/contrib/xml2/xslt_proc.c b/contrib/xml2/xslt_proc.c index a1e18671ce8..c8ae52498e0 100644 --- a/contrib/xml2/xslt_proc.c +++ b/contrib/xml2/xslt_proc.c @@ -60,7 +60,7 @@ xslt_process(PG_FUNCTION_ARGS) volatile xsltSecurityPrefsPtr xslt_sec_prefs = NULL; volatile xsltTransformContextPtr xslt_ctxt = NULL; volatile int resstat = -1; - xmlChar *volatile resstr = NULL; + xmlChar *volatile resstrv = NULL; if (fcinfo->nargs == 3) { @@ -80,6 +80,7 @@ xslt_process(PG_FUNCTION_ARGS) PG_TRY(); { bool xslt_sec_prefs_error; + xmlChar *resstr = NULL; int reslen = 0; /* Parse document */ @@ -147,8 +148,8 @@ xslt_process(PG_FUNCTION_ARGS) xml_ereport(xmlerrcxt, ERROR, ERRCODE_INVALID_ARGUMENT_FOR_XQUERY, "failed to apply stylesheet"); - resstat = xsltSaveResultToString((xmlChar **) &resstr, &reslen, - restree, stylesheet); + resstat = xsltSaveResultToString(&resstr, &reslen, restree, stylesheet); + resstrv = resstr; if (resstat >= 0) { @@ -176,8 +177,8 @@ xslt_process(PG_FUNCTION_ARGS) xmlFreeDoc(ssdoc); if (doctree != NULL) xmlFreeDoc(doctree); - if (resstr != NULL) - xmlFree(resstr); + if (resstrv != NULL) + xmlFree(resstrv); xsltCleanupGlobals(); pg_xml_done(xmlerrcxt, true); @@ -193,8 +194,8 @@ xslt_process(PG_FUNCTION_ARGS) xmlFreeDoc(doctree); xsltCleanupGlobals(); - if (resstr) - xmlFree(resstr); + if (resstrv) + xmlFree(resstrv); pg_xml_done(xmlerrcxt, false); -- 2.55.0