diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-05-04 16:42:41 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-05-04 16:42:41 +0000 |
commit | 45173ae24e308061c008f77996f3edbebe0e4dc2 (patch) | |
tree | 9dd9bd3cc11648b13dd0ccee488014421adbe274 /contrib/xml2/xslt_proc.c | |
parent | 0ff74f03b153abfe4cc10abe7be5a13cdbcac782 (diff) | |
download | postgresql-45173ae24e308061c008f77996f3edbebe0e4dc2.tar.gz postgresql-45173ae24e308061c008f77996f3edbebe0e4dc2.zip |
Use new cstring/text conversion functions in some additional places.
These changes assume that the varchar and xml data types are represented
the same as text. (I did not, however, accept the portions of the proposed
patch that wanted to assume bytea is the same as text --- tgl.)
Brendan Jurd
Diffstat (limited to 'contrib/xml2/xslt_proc.c')
-rw-r--r-- | contrib/xml2/xslt_proc.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/contrib/xml2/xslt_proc.c b/contrib/xml2/xslt_proc.c index f15fabcb3c5..f4981924260 100644 --- a/contrib/xml2/xslt_proc.c +++ b/contrib/xml2/xslt_proc.c @@ -39,8 +39,9 @@ PG_FUNCTION_INFO_V1(xslt_process); Datum xslt_process(PG_FUNCTION_ARGS) { - - + text *doct = PG_GETARG_TEXT_P(0); + text *ssheet = PG_GETARG_TEXT_P(1); + text *paramstr; const char *params[MAXPARAMS + 1]; /* +1 for the terminator */ xsltStylesheetPtr stylesheet = NULL; xmlDocPtr doctree; @@ -50,12 +51,6 @@ xslt_process(PG_FUNCTION_ARGS) int resstat; int reslen; - text *doct = PG_GETARG_TEXT_P(0); - text *ssheet = PG_GETARG_TEXT_P(1); - text *paramstr; - text *tres; - - if (fcinfo->nargs == 3) { paramstr = PG_GETARG_TEXT_P(2); @@ -124,11 +119,7 @@ xslt_process(PG_FUNCTION_ARGS) if (resstat < 0) PG_RETURN_NULL(); - tres = palloc(reslen + VARHDRSZ); - memcpy(VARDATA(tres), resstr, reslen); - SET_VARSIZE(tres, reslen + VARHDRSZ); - - PG_RETURN_TEXT_P(tres); + PG_RETURN_TEXT_P(cstring_to_text_with_len(resstr, reslen)); } |