Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/xml2')
-rw-r--r--contrib/xml2/xpath.c15
-rw-r--r--contrib/xml2/xslt_proc.c9
2 files changed, 8 insertions, 16 deletions
diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c
index b02f9577772..52cc3d379fd 100644
--- a/contrib/xml2/xpath.c
+++ b/contrib/xml2/xpath.c
@@ -55,11 +55,6 @@ Datum xpath_table(PG_FUNCTION_ARGS);
char *errbuf; /* per line error buffer */
char *pgxml_errorMsg = NULL; /* overall error message */
-/* Convenience macros */
-
-#define GET_TEXT(cstrp) DatumGetTextP(DirectFunctionCall1(textin, CStringGetDatum(cstrp)))
-#define GET_STR(textp) DatumGetCString(DirectFunctionCall1(textout, PointerGetDatum(textp)))
-
#define ERRBUF_SIZE 200
/* memory handling passthrough functions (e.g. palloc, pstrdup are
@@ -651,11 +646,11 @@ xpath_table(PG_FUNCTION_ARGS)
MemoryContext oldcontext;
/* Function parameters */
- char *pkeyfield = GET_STR(PG_GETARG_TEXT_P(0));
- char *xmlfield = GET_STR(PG_GETARG_TEXT_P(1));
- char *relname = GET_STR(PG_GETARG_TEXT_P(2));
- char *xpathset = GET_STR(PG_GETARG_TEXT_P(3));
- char *condition = GET_STR(PG_GETARG_TEXT_P(4));
+ char *pkeyfield = text_to_cstring(PG_GETARG_TEXT_PP(0));
+ char *xmlfield = text_to_cstring(PG_GETARG_TEXT_PP(1));
+ char *relname = text_to_cstring(PG_GETARG_TEXT_PP(2));
+ char *xpathset = text_to_cstring(PG_GETARG_TEXT_PP(3));
+ char *condition = text_to_cstring(PG_GETARG_TEXT_PP(4));
char **values;
xmlChar **xpaths;
diff --git a/contrib/xml2/xslt_proc.c b/contrib/xml2/xslt_proc.c
index b89102245c5..f15fabcb3c5 100644
--- a/contrib/xml2/xslt_proc.c
+++ b/contrib/xml2/xslt_proc.c
@@ -22,13 +22,10 @@
/* declarations to come from xpath.c */
-
extern void elog_error(int level, char *explain, int force);
extern void pgxml_parser_init();
extern xmlChar *pgxml_texttoxmlchar(text *textstring);
-#define GET_STR(textp) DatumGetCString(DirectFunctionCall1(textout, PointerGetDatum(textp)))
-
/* local defs */
static void parse_params(const char **params, text *paramstr);
@@ -76,7 +73,7 @@ xslt_process(PG_FUNCTION_ARGS)
if (VARDATA(doct)[0] == '<')
doctree = xmlParseMemory((char *) VARDATA(doct), VARSIZE(doct) - VARHDRSZ);
else
- doctree = xmlParseFile(GET_STR(doct));
+ doctree = xmlParseFile(text_to_cstring(doct));
if (doctree == NULL)
{
@@ -102,7 +99,7 @@ xslt_process(PG_FUNCTION_ARGS)
stylesheet = xsltParseStylesheetDoc(ssdoc);
}
else
- stylesheet = xsltParseStylesheetFile((xmlChar *) GET_STR(ssheet));
+ stylesheet = xsltParseStylesheetFile((xmlChar *) text_to_cstring(ssheet));
if (stylesheet == NULL)
@@ -145,7 +142,7 @@ parse_params(const char **params, text *paramstr)
char *nvsep = "=";
char *itsep = ",";
- pstr = GET_STR(paramstr);
+ pstr = text_to_cstring(paramstr);
pos = pstr;