Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65c5864

Browse files
committed
xml2: Replace deprecated routines with recommended ones
Some functions are used in the tree and are currently marked asdeprecated by upstream. This commit refreshes the code to use therecommended functions, leading to the following changes:- xmlSubstituteEntitiesDefault() is gone, and needs to be replaced withXML_PARSE_NOENT for the paths doing the parsing.- xmlParseMemory() -> xmlReadMemory().These functions, as well as more functions setting global states, havebeen officially marked as deprecated by upstream in August 2022. Theirreplacements exist since the 2001-ish area, as far as I have checked,so that should be safe.Author: Dmitry KovalDiscussion:https://postgr.es/m/18274-98d16bc03520665f@postgresql.org
1 parent8ad1f7d commit65c5864

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

‎contrib/xml2/xpath.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ pgxml_parser_init(PgXmlStrictness strictness)
7474
/* Initialize libxml */
7575
xmlInitParser();
7676

77-
xmlSubstituteEntitiesDefault(1);
7877
xmlLoadExtDtdDefaultValue=1;
7978

8079
returnxmlerrcxt;
@@ -380,8 +379,9 @@ pgxml_xpath(text *document, xmlChar *xpath, xpath_workspace *workspace)
380379

381380
PG_TRY();
382381
{
383-
workspace->doctree=xmlParseMemory((char*)VARDATA_ANY(document),
384-
docsize);
382+
workspace->doctree=xmlReadMemory((char*)VARDATA_ANY(document),
383+
docsize,NULL,NULL,
384+
XML_PARSE_NOENT);
385385
if (workspace->doctree!=NULL)
386386
{
387387
workspace->ctxt=xmlXPathNewContext(workspace->doctree);
@@ -624,7 +624,9 @@ xpath_table(PG_FUNCTION_ARGS)
624624

625625
/* Parse the document */
626626
if (xmldoc)
627-
doctree=xmlParseMemory(xmldoc,strlen(xmldoc));
627+
doctree=xmlReadMemory(xmldoc,strlen(xmldoc),
628+
NULL,NULL,
629+
XML_PARSE_NOENT);
628630
else/* treat NULL as not well-formed */
629631
doctree=NULL;
630632

‎contrib/xml2/xslt_proc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,18 @@ xslt_process(PG_FUNCTION_ARGS)
8585
boolxslt_sec_prefs_error;
8686

8787
/* Parse document */
88-
doctree=xmlParseMemory((char*)VARDATA_ANY(doct),
89-
VARSIZE_ANY_EXHDR(doct));
88+
doctree=xmlReadMemory((char*)VARDATA_ANY(doct),
89+
VARSIZE_ANY_EXHDR(doct),NULL,NULL,
90+
XML_PARSE_NOENT);
9091

9192
if (doctree==NULL)
9293
xml_ereport(xmlerrcxt,ERROR,ERRCODE_EXTERNAL_ROUTINE_EXCEPTION,
9394
"error parsing XML document");
9495

9596
/* Same for stylesheet */
96-
ssdoc=xmlParseMemory((char*)VARDATA_ANY(ssheet),
97-
VARSIZE_ANY_EXHDR(ssheet));
97+
ssdoc=xmlReadMemory((char*)VARDATA_ANY(ssheet),
98+
VARSIZE_ANY_EXHDR(ssheet),NULL,NULL,
99+
XML_PARSE_NOENT);
98100

99101
if (ssdoc==NULL)
100102
xml_ereport(xmlerrcxt,ERROR,ERRCODE_EXTERNAL_ROUTINE_EXCEPTION,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp