From 3c92d5fdd973ec3b386658ab1f2a72990c6cce44 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 1 Dec 2007 17:58:54 +0000 Subject: [PATCH] Suppress compiler warnings in recent plperl patch. Avoid uselessly expensive lookup of the well-known OID of textout(). --- src/pl/plperl/plperl.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index f5d03a2b7dd..fe7fa0bd216 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -33,7 +33,7 @@ * ENHANCEMENTS, OR MODIFICATIONS. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.94.2.8 2007/12/01 15:39:49 adunstan Exp $ + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.94.2.9 2007/12/01 17:58:54 tgl Exp $ * **********************************************************************/ @@ -51,6 +51,7 @@ #include "commands/trigger.h" #include "executor/spi.h" #include "funcapi.h" +#include "utils/fmgroids.h" #include "utils/lsyscache.h" #include "utils/memutils.h" #include "utils/typcache.h" @@ -400,7 +401,6 @@ plperl_safe_init(void) eval_pv(SAFE_OK, FALSE); if (GetDatabaseEncoding() == PG_UTF8) { - /* * Fill in just enough information to set up this perl * function in the safe container and call it. @@ -408,12 +408,8 @@ plperl_safe_init(void) * can arise from the regex code later trying to load * utf8 modules. */ - plperl_proc_desc desc; FunctionCallInfoData fcinfo; - FmgrInfo outfunc; - HeapTuple typeTup; - Form_pg_type typeStruct; SV *ret; SV *func; @@ -425,24 +421,17 @@ plperl_safe_init(void) "return shift =~ /\\xa9/i ? 'true' : 'false' ;", true); - /* set up to call the function with a single text argument 'a' */ desc.reference = func; desc.nargs = 1; desc.arg_is_rowtype[0] = false; + fmgr_info(F_TEXTOUT, &(desc.arg_out_func[0])); + + fcinfo.arg[0] = DirectFunctionCall1(textin, CStringGetDatum("a")); fcinfo.argnull[0] = false; - fcinfo.arg[0] = - DatumGetTextP(DirectFunctionCall1(textin, - CStringGetDatum("a"))); - typeTup = SearchSysCache(TYPEOID, - TEXTOID, - 0, 0, 0); - typeStruct = (Form_pg_type) GETSTRUCT(typeTup); - fmgr_info(typeStruct->typoutput,&(desc.arg_out_func[0])); - ReleaseSysCache(typeTup); /* and make the call */ - ret = plperl_call_perl_func(&desc,&fcinfo); + ret = plperl_call_perl_func(&desc, &fcinfo); } } -- 2.39.5