aboutsummaryrefslogtreecommitdiff
path: root/contrib/xml2/xslt_proc.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2024-01-17 08:53:16 +0900
committerMichael Paquier <michael@paquier.xyz>2024-01-17 08:53:16 +0900
commit65c5864d7fac46516f17ee89085e349a87ee5bd7 (patch)
tree47be1cbbec1f0fb01cab34c469ef1c3120d1285f /contrib/xml2/xslt_proc.c
parent8ad1f7db87f0375cfd7c6ae24aa13bdbdff2477a (diff)
downloadpostgresql-65c5864d7fac46516f17ee89085e349a87ee5bd7.tar.gz
postgresql-65c5864d7fac46516f17ee89085e349a87ee5bd7.zip
xml2: Replace deprecated routines with recommended ones
Some functions are used in the tree and are currently marked as deprecated by upstream. This commit refreshes the code to use the recommended functions, leading to the following changes: - xmlSubstituteEntitiesDefault() is gone, and needs to be replaced with XML_PARSE_NOENT for the paths doing the parsing. - xmlParseMemory() -> xmlReadMemory(). These functions, as well as more functions setting global states, have been officially marked as deprecated by upstream in August 2022. Their replacements exist since the 2001-ish area, as far as I have checked, so that should be safe. Author: Dmitry Koval Discussion: https://postgr.es/m/18274-98d16bc03520665f@postgresql.org
Diffstat (limited to 'contrib/xml2/xslt_proc.c')
-rw-r--r--contrib/xml2/xslt_proc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/xml2/xslt_proc.c b/contrib/xml2/xslt_proc.c
index 2189bca86ff..f30a3a42c03 100644
--- a/contrib/xml2/xslt_proc.c
+++ b/contrib/xml2/xslt_proc.c
@@ -85,16 +85,18 @@ xslt_process(PG_FUNCTION_ARGS)
bool xslt_sec_prefs_error;
/* Parse document */
- doctree = xmlParseMemory((char *) VARDATA_ANY(doct),
- VARSIZE_ANY_EXHDR(doct));
+ doctree = xmlReadMemory((char *) VARDATA_ANY(doct),
+ VARSIZE_ANY_EXHDR(doct), NULL, NULL,
+ XML_PARSE_NOENT);
if (doctree == NULL)
xml_ereport(xmlerrcxt, ERROR, ERRCODE_EXTERNAL_ROUTINE_EXCEPTION,
"error parsing XML document");
/* Same for stylesheet */
- ssdoc = xmlParseMemory((char *) VARDATA_ANY(ssheet),
- VARSIZE_ANY_EXHDR(ssheet));
+ ssdoc = xmlReadMemory((char *) VARDATA_ANY(ssheet),
+ VARSIZE_ANY_EXHDR(ssheet), NULL, NULL,
+ XML_PARSE_NOENT);
if (ssdoc == NULL)
xml_ereport(xmlerrcxt, ERROR, ERRCODE_EXTERNAL_ROUTINE_EXCEPTION,