diff options
author | Pavan Deolasee | 2017-06-14 05:42:18 +0000 |
---|---|---|
committer | Pavan Deolasee | 2017-06-14 05:42:18 +0000 |
commit | 15dd5274c323fb93e4e3ea9ad2185aaaec10f79c (patch) | |
tree | 9dafb4c7f735d9429ea461dc792933af87493c33 /contrib/xml2/xpath.c | |
parent | dfbb88e3bbb526dcb204b456b9e5cfd9d10d0d0a (diff) | |
parent | d5cb3bab564e0927ffac7c8729eacf181a12dd40 (diff) |
Merge from PG master upto d5cb3bab564e0927ffac7c8729eacf181a12dd40
This is the result of the "git merge remotes/PGSQL/master" upto the said commit
point. We have done some basic analysis, fixed compilation problems etc, but
bulk of the logical problems in conflict resolution etc will be handled by
subsequent commits.
Diffstat (limited to 'contrib/xml2/xpath.c')
-rw-r--r-- | contrib/xml2/xpath.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c index ac28996867..034545caa8 100644 --- a/contrib/xml2/xpath.c +++ b/contrib/xml2/xpath.c @@ -95,9 +95,9 @@ PG_FUNCTION_INFO_V1(xml_is_well_formed); Datum xml_is_well_formed(PG_FUNCTION_ARGS) { - text *t = PG_GETARG_TEXT_P(0); /* document buffer */ + text *t = PG_GETARG_TEXT_PP(0); /* document buffer */ bool result = false; - int32 docsize = VARSIZE(t) - VARHDRSZ; + int32 docsize = VARSIZE_ANY_EXHDR(t); xmlDocPtr doctree; PgXmlErrorContext *xmlerrcxt; @@ -105,7 +105,7 @@ xml_is_well_formed(PG_FUNCTION_ARGS) PG_TRY(); { - doctree = xmlParseMemory((char *) VARDATA(t), docsize); + doctree = xmlParseMemory((char *) VARDATA_ANY(t), docsize); result = (doctree != NULL); @@ -133,7 +133,7 @@ PG_FUNCTION_INFO_V1(xml_encode_special_chars); Datum xml_encode_special_chars(PG_FUNCTION_ARGS) { - text *tin = PG_GETARG_TEXT_P(0); + text *tin = PG_GETARG_TEXT_PP(0); text *tout; xmlChar *ts, *tt; @@ -248,10 +248,10 @@ PG_FUNCTION_INFO_V1(xpath_nodeset); Datum xpath_nodeset(PG_FUNCTION_ARGS) { - text *document = PG_GETARG_TEXT_P(0); - text *xpathsupp = PG_GETARG_TEXT_P(1); /* XPath expression */ - xmlChar *toptag = pgxml_texttoxmlchar(PG_GETARG_TEXT_P(2)); - xmlChar *septag = pgxml_texttoxmlchar(PG_GETARG_TEXT_P(3)); + text *document = PG_GETARG_TEXT_PP(0); + text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ + xmlChar *toptag = pgxml_texttoxmlchar(PG_GETARG_TEXT_PP(2)); + xmlChar *septag = pgxml_texttoxmlchar(PG_GETARG_TEXT_PP(3)); xmlChar *xpath; text *xpres; xmlXPathObjectPtr res; @@ -281,9 +281,9 @@ PG_FUNCTION_INFO_V1(xpath_list); Datum xpath_list(PG_FUNCTION_ARGS) { - text *document = PG_GETARG_TEXT_P(0); - text *xpathsupp = PG_GETARG_TEXT_P(1); /* XPath expression */ - xmlChar *plainsep = pgxml_texttoxmlchar(PG_GETARG_TEXT_P(2)); + text *document = PG_GETARG_TEXT_PP(0); + text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ + xmlChar *plainsep = pgxml_texttoxmlchar(PG_GETARG_TEXT_PP(2)); xmlChar *xpath; text *xpres; xmlXPathObjectPtr res; @@ -310,15 +310,15 @@ PG_FUNCTION_INFO_V1(xpath_string); Datum xpath_string(PG_FUNCTION_ARGS) { - text *document = PG_GETARG_TEXT_P(0); - text *xpathsupp = PG_GETARG_TEXT_P(1); /* XPath expression */ + text *document = PG_GETARG_TEXT_PP(0); + text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ xmlChar *xpath; int32 pathsize; text *xpres; xmlXPathObjectPtr res; xpath_workspace workspace; - pathsize = VARSIZE(xpathsupp) - VARHDRSZ; + pathsize = VARSIZE_ANY_EXHDR(xpathsupp); /* * We encapsulate the supplied path with "string()" = 8 chars + 1 for NUL @@ -328,7 +328,7 @@ xpath_string(PG_FUNCTION_ARGS) xpath = (xmlChar *) palloc(pathsize + 9); memcpy((char *) xpath, "string(", 7); - memcpy((char *) (xpath + 7), VARDATA(xpathsupp), pathsize); + memcpy((char *) (xpath + 7), VARDATA_ANY(xpathsupp), pathsize); xpath[pathsize + 7] = ')'; xpath[pathsize + 8] = '\0'; @@ -351,8 +351,8 @@ PG_FUNCTION_INFO_V1(xpath_number); Datum xpath_number(PG_FUNCTION_ARGS) { - text *document = PG_GETARG_TEXT_P(0); - text *xpathsupp = PG_GETARG_TEXT_P(1); /* XPath expression */ + text *document = PG_GETARG_TEXT_PP(0); + text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ xmlChar *xpath; float4 fRes; xmlXPathObjectPtr res; @@ -383,8 +383,8 @@ PG_FUNCTION_INFO_V1(xpath_bool); Datum xpath_bool(PG_FUNCTION_ARGS) { - text *document = PG_GETARG_TEXT_P(0); - text *xpathsupp = PG_GETARG_TEXT_P(1); /* XPath expression */ + text *document = PG_GETARG_TEXT_PP(0); + text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ xmlChar *xpath; int bRes; xmlXPathObjectPtr res; @@ -413,7 +413,7 @@ xpath_bool(PG_FUNCTION_ARGS) static xmlXPathObjectPtr pgxml_xpath(text *document, xmlChar *xpath, xpath_workspace *workspace) { - int32 docsize = VARSIZE(document) - VARHDRSZ; + int32 docsize = VARSIZE_ANY_EXHDR(document); PgXmlErrorContext *xmlerrcxt; xmlXPathCompExprPtr comppath; @@ -425,7 +425,7 @@ pgxml_xpath(text *document, xmlChar *xpath, xpath_workspace *workspace) PG_TRY(); { - workspace->doctree = xmlParseMemory((char *) VARDATA(document), + workspace->doctree = xmlParseMemory((char *) VARDATA_ANY(document), docsize); if (workspace->doctree != NULL) { @@ -610,7 +610,7 @@ xpath_table(PG_FUNCTION_ARGS) /* * At the moment we assume that the returned attributes make sense for the - * XPath specififed (i.e. we trust the caller). It's not fatal if they get + * XPath specified (i.e. we trust the caller). It's not fatal if they get * it wrong - the input function for the column type will raise an error * if the path result can't be converted into the correct binary * representation. |