Skip to content

Commit ba9da68

Browse files
committed
Suppress compiler warnings in recent plperl patch. Avoid uselessly expensive
lookup of the well-known OID of textout().
1 parent b8f2875 commit ba9da68

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

src/pl/plperl/plperl.c

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**********************************************************************
22
* plperl.c - perl as a procedural language for PostgreSQL
33
*
4-
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.133 2007/12/01 15:20:34 adunstan Exp $
4+
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.134 2007/12/01 17:58:42 tgl Exp $
55
*
66
**********************************************************************/
77

@@ -23,6 +23,7 @@
2323
#include "miscadmin.h"
2424
#include "nodes/makefuncs.h"
2525
#include "parser/parse_type.h"
26+
#include "utils/fmgroids.h"
2627
#include "utils/guc.h"
2728
#include "utils/lsyscache.h"
2829
#include "utils/memutils.h"
@@ -508,50 +509,37 @@ plperl_safe_init(void)
508509
eval_pv(SAFE_OK, FALSE);
509510
if (GetDatabaseEncoding() == PG_UTF8)
510511
{
511-
512512
/*
513513
* Fill in just enough information to set up this perl
514514
* function in the safe container and call it.
515515
* For some reason not entirely clear, it prevents errors that
516516
* can arise from the regex code later trying to load
517517
* utf8 modules.
518518
*/
519-
520519
plperl_proc_desc desc;
521520
FunctionCallInfoData fcinfo;
522-
FmgrInfo outfunc;
523-
HeapTuple typeTup;
524-
Form_pg_type typeStruct;
525521
SV *ret;
526522
SV *func;
527523

528524
/* make sure we don't call ourselves recursively */
529525
plperl_safe_init_done = true;
530526

531527
/* compile the function */
532-
func = plperl_create_sub(
533-
"utf8fix",
534-
"return shift =~ /\\xa9/i ? 'true' : 'false' ;",
535-
true);
536-
528+
func = plperl_create_sub("utf8fix",
529+
"return shift =~ /\\xa9/i ? 'true' : 'false' ;",
530+
true);
537531

538532
/* set up to call the function with a single text argument 'a' */
539533
desc.reference = func;
540534
desc.nargs = 1;
541535
desc.arg_is_rowtype[0] = false;
536+
fmgr_info(F_TEXTOUT, &(desc.arg_out_func[0]));
537+
538+
fcinfo.arg[0] = DirectFunctionCall1(textin, CStringGetDatum("a"));
542539
fcinfo.argnull[0] = false;
543-
fcinfo.arg[0] =
544-
DatumGetTextP(DirectFunctionCall1(textin,
545-
CStringGetDatum("a")));
546-
typeTup = SearchSysCache(TYPEOID,
547-
TEXTOID,
548-
0, 0, 0);
549-
typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
550-
fmgr_info(typeStruct->typoutput,&(desc.arg_out_func[0]));
551-
ReleaseSysCache(typeTup);
552540

553541
/* and make the call */
554-
ret = plperl_call_perl_func(&desc,&fcinfo);
542+
ret = plperl_call_perl_func(&desc, &fcinfo);
555543
}
556544
}
557545

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy