diff options
Diffstat (limited to 'src/pl/plperl')
-rw-r--r-- | src/pl/plperl/plperl.c | 173 | ||||
-rw-r--r-- | src/pl/plperl/ppport.h | 555 | ||||
-rw-r--r-- | src/pl/plperl/spi_internal.c | 49 | ||||
-rw-r--r-- | src/pl/plperl/spi_internal.h | 4 |
4 files changed, 392 insertions, 389 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 2d368a68ef9..4ccb7ec6e34 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.48 2004/07/31 00:45:44 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.49 2004/08/29 05:07:01 momjian Exp $ * **********************************************************************/ @@ -79,7 +79,7 @@ typedef struct plperl_proc_desc CommandId fn_cmin; bool lanpltrusted; bool fn_retistuple; /* true, if function returns tuple */ - bool fn_retisset; /*true, if function returns set*/ + bool fn_retisset; /* true, if function returns set */ Oid ret_oid; /* Oid of returning type */ FmgrInfo result_in_func; Oid result_typioparam; @@ -98,10 +98,10 @@ static int plperl_firstcall = 1; static bool plperl_safe_init_done = false; static PerlInterpreter *plperl_interp = NULL; static HV *plperl_proc_hash = NULL; -static AV *g_row_keys = NULL; -static AV *g_column_keys = NULL; -static SV *srf_perlret=NULL; /*keep returned value*/ -static int g_attr_num = 0; +static AV *g_row_keys = NULL; +static AV *g_column_keys = NULL; +static SV *srf_perlret = NULL; /* keep returned value */ +static int g_attr_num = 0; /********************************************************************** * Forward declarations @@ -214,8 +214,8 @@ plperl_init_interp(void) "", "-e", /* - * no commas between the next lines please. They are supposed to be - * one string + * no commas between the next lines please. They are supposed to + * be one string */ "SPI::bootstrap(); use vars qw(%_SHARED);" "sub ::mkunsafefunc {return eval(qq[ sub { $_[0] $_[1] } ]); }" @@ -240,33 +240,33 @@ plperl_init_interp(void) static void plperl_safe_init(void) { - static char *safe_module = - "require Safe; $Safe::VERSION"; + static char *safe_module = + "require Safe; $Safe::VERSION"; - static char * safe_ok = - "use vars qw($PLContainer); $PLContainer = new Safe('PLPerl');" - "$PLContainer->permit_only(':default');$PLContainer->permit(':base_math');" - "$PLContainer->share(qw[&elog &spi_exec_query &DEBUG &LOG &INFO &NOTICE &WARNING &ERROR %SHARED ]);" - "sub ::mksafefunc { return $PLContainer->reval(qq[sub { $_[0] $_[1]}]); }" - ; + static char *safe_ok = + "use vars qw($PLContainer); $PLContainer = new Safe('PLPerl');" + "$PLContainer->permit_only(':default');$PLContainer->permit(':base_math');" + "$PLContainer->share(qw[&elog &spi_exec_query &DEBUG &LOG &INFO &NOTICE &WARNING &ERROR %SHARED ]);" + "sub ::mksafefunc { return $PLContainer->reval(qq[sub { $_[0] $_[1]}]); }" + ; - static char * safe_bad = - "use vars qw($PLContainer); $PLContainer = new Safe('PLPerl');" - "$PLContainer->permit_only(':default');$PLContainer->permit(':base_math');" - "$PLContainer->share(qw[&elog &DEBUG &LOG &INFO &NOTICE &WARNING &ERROR %SHARED ]);" - "sub ::mksafefunc { return $PLContainer->reval(qq[sub { " - "elog(ERROR,'trusted perl functions disabled - please upgrade perl Safe module to at least 2.09');}]); }" - ; + static char *safe_bad = + "use vars qw($PLContainer); $PLContainer = new Safe('PLPerl');" + "$PLContainer->permit_only(':default');$PLContainer->permit(':base_math');" + "$PLContainer->share(qw[&elog &DEBUG &LOG &INFO &NOTICE &WARNING &ERROR %SHARED ]);" + "sub ::mksafefunc { return $PLContainer->reval(qq[sub { " + "elog(ERROR,'trusted perl functions disabled - please upgrade perl Safe module to at least 2.09');}]); }" + ; - SV * res; + SV *res; - float safe_version; + float safe_version; - res = eval_pv(safe_module,FALSE); /* TRUE = croak if failure */ + res = eval_pv(safe_module, FALSE); /* TRUE = croak if failure */ safe_version = SvNV(res); - eval_pv((safe_version < 2.09 ? safe_bad : safe_ok),FALSE); + eval_pv((safe_version < 2.09 ? safe_bad : safe_ok), FALSE); plperl_safe_init_done = true; } @@ -431,7 +431,7 @@ plperl_is_set(SV * sv) /********************************************************************** * extract a list of keys from a hash **********************************************************************/ -static AV * +static AV * plperl_get_keys(HV * hv) { AV *ret; @@ -523,9 +523,9 @@ plperl_modify_tuple(HV * hvTD, TriggerData *tdata, HeapTuple otup, Oid fn_oid) elog(ERROR, "plperl: $_TD->{new} is not a hash"); plkeys = plperl_get_keys(hvNew); - natts = av_len(plkeys)+1; - if (natts != tupdesc->natts) - elog(ERROR, "plperl: $_TD->{new} has an incorrect number of keys."); + natts = av_len(plkeys) + 1; + if (natts != tupdesc->natts) + elog(ERROR, "plperl: $_TD->{new} has an incorrect number of keys."); modattrs = palloc0(natts * sizeof(int)); modvalues = palloc0(natts * sizeof(Datum)); @@ -558,7 +558,7 @@ plperl_modify_tuple(HV * hvTD, TriggerData *tdata, HeapTuple otup, Oid fn_oid) modvalues[i] = FunctionCall3(&finfo, CStringGetDatum(plval), ObjectIdGetDatum(typelem), - Int32GetDatum(tupdesc->attrs[atti]->atttypmod)); + Int32GetDatum(tupdesc->attrs[atti]->atttypmod)); modnulls[i] = ' '; } else @@ -629,7 +629,7 @@ plperl_create_sub(char *s, bool trusted) SV *subref; int count; - if(trusted && !plperl_safe_init_done) + if (trusted && !plperl_safe_init_done) plperl_safe_init(); ENTER; @@ -770,7 +770,7 @@ plperl_call_perl_func(plperl_proc_desc * desc, FunctionCallInfo fcinfo) tmp = DatumGetCString(FunctionCall3(&(desc->arg_out_func[i]), fcinfo->arg[i], - ObjectIdGetDatum(desc->arg_typioparam[i]), + ObjectIdGetDatum(desc->arg_typioparam[i]), Int32GetDatum(-1))); XPUSHs(sv_2mortal(newSVpv(tmp, 0))); pfree(tmp); @@ -877,21 +877,21 @@ plperl_func_handler(PG_FUNCTION_ARGS) /************************************************************ * Call the Perl function if not returning set ************************************************************/ - if (!prodesc->fn_retisset) - perlret = plperl_call_perl_func(prodesc, fcinfo); - else + if (!prodesc->fn_retisset) + perlret = plperl_call_perl_func(prodesc, fcinfo); + else { - if (SRF_IS_FIRSTCALL()) /*call function only once*/ + if (SRF_IS_FIRSTCALL()) /* call function only once */ srf_perlret = plperl_call_perl_func(prodesc, fcinfo); perlret = srf_perlret; - } + } - if (prodesc->fn_retisset && SRF_IS_FIRSTCALL()) - { + if (prodesc->fn_retisset && SRF_IS_FIRSTCALL()) + { if (prodesc->fn_retistuple) g_column_keys = newAV(); if (SvTYPE(perlret) != SVt_RV) - elog(ERROR, "plperl: set-returning function must return reference"); + elog(ERROR, "plperl: set-returning function must return reference"); } /************************************************************ @@ -903,7 +903,7 @@ plperl_func_handler(PG_FUNCTION_ARGS) if (SPI_finish() != SPI_OK_FINISH) elog(ERROR, "SPI_finish() failed"); - if (!(perlret && SvOK(perlret) && SvTYPE(perlret)!=SVt_NULL )) + if (!(perlret && SvOK(perlret) && SvTYPE(perlret) != SVt_NULL)) { /* return NULL if Perl code returned undef */ retval = (Datum) 0; @@ -916,7 +916,7 @@ plperl_func_handler(PG_FUNCTION_ARGS) if (prodesc->fn_retistuple && perlret && SvTYPE(perlret) != SVt_RV) elog(ERROR, "plperl: composite-returning function must return a reference"); - if (prodesc->fn_retistuple && fcinfo->resultinfo ) /* set of tuples */ + if (prodesc->fn_retistuple && fcinfo->resultinfo) /* set of tuples */ { /* SRF support */ HV *ret_hv; @@ -930,13 +930,13 @@ plperl_func_handler(PG_FUNCTION_ARGS) AttInMetadata *attinmeta; bool isset = 0; char **values = NULL; - ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo; + ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo; if (prodesc->fn_retisset && !rsinfo) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("returning a composite type is not allowed in this context"), - errhint("This function is intended for use in the FROM clause."))); + errmsg("returning a composite type is not allowed in this context"), + errhint("This function is intended for use in the FROM clause."))); isset = plperl_is_set(perlret); @@ -1020,8 +1020,8 @@ plperl_func_handler(PG_FUNCTION_ARGS) values[i] = NULL; } } - else - { + else + { int i; values = (char **) palloc(g_attr_num * sizeof(char *)); @@ -1045,38 +1045,38 @@ plperl_func_handler(PG_FUNCTION_ARGS) SRF_RETURN_DONE(funcctx); } } - else if (prodesc->fn_retisset) /* set of non-tuples */ + else if (prodesc->fn_retisset) /* set of non-tuples */ { - FuncCallContext *funcctx; - + FuncCallContext *funcctx; + if (SRF_IS_FIRSTCALL()) { MemoryContext oldcontext; - int i; + int i; funcctx = SRF_FIRSTCALL_INIT(); oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx); funcctx->max_calls = av_len((AV *) SvRV(perlret)) + 1; } - + funcctx = SRF_PERCALL_SETUP(); - + if (funcctx->call_cntr < funcctx->max_calls) { Datum result; - AV* array; - SV** svp; - int i; + AV *array; + SV **svp; + int i; - array = (AV*)SvRV(perlret); + array = (AV *) SvRV(perlret); svp = av_fetch(array, funcctx->call_cntr, FALSE); if (SvTYPE(*svp) != SVt_NULL) result = FunctionCall3(&prodesc->result_in_func, - PointerGetDatum(SvPV(*svp, PL_na)), - ObjectIdGetDatum(prodesc->result_typioparam), - Int32GetDatum(-1)); + PointerGetDatum(SvPV(*svp, PL_na)), + ObjectIdGetDatum(prodesc->result_typioparam), + Int32GetDatum(-1)); else { fcinfo->isnull = true; @@ -1084,27 +1084,28 @@ plperl_func_handler(PG_FUNCTION_ARGS) } SRF_RETURN_NEXT(funcctx, result); fcinfo->isnull = false; - } + } else { if (perlret) SvREFCNT_dec(perlret); SRF_RETURN_DONE(funcctx); } - } - else if (!fcinfo->isnull) /* non-null singleton */ + } + else if (!fcinfo->isnull) /* non-null singleton */ { - if (prodesc->fn_retistuple) /* singleton perl hash to Datum */ + if (prodesc->fn_retistuple) /* singleton perl hash to Datum */ { - TupleDesc td = lookup_rowtype_tupdesc(prodesc->ret_oid,(int32)-1); - HV * perlhash = (HV *) SvRV(perlret); - int i; - char **values; - char * key, *val; + TupleDesc td = lookup_rowtype_tupdesc(prodesc->ret_oid, (int32) -1); + HV *perlhash = (HV *) SvRV(perlret); + int i; + char **values; + char *key, + *val; AttInMetadata *attinmeta; - HeapTuple tup; + HeapTuple tup; if (!td) ereport(ERROR, @@ -1115,7 +1116,7 @@ plperl_func_handler(PG_FUNCTION_ARGS) for (i = 0; i < td->natts; i++) { - key = SPI_fname(td,i+1); + key = SPI_fname(td, i + 1); val = plperl_get_elem(perlhash, key); if (val) values[i] = val; @@ -1125,14 +1126,15 @@ plperl_func_handler(PG_FUNCTION_ARGS) attinmeta = TupleDescGetAttInMetadata(td); tup = BuildTupleFromCStrings(attinmeta, values); retval = HeapTupleGetDatum(tup); - + } - else /* perl string to Datum */ + else +/* perl string to Datum */ - retval = FunctionCall3(&prodesc->result_in_func, - PointerGetDatum(SvPV(perlret, PL_na)), - ObjectIdGetDatum(prodesc->result_typioparam), - Int32GetDatum(-1)); + retval = FunctionCall3(&prodesc->result_in_func, + PointerGetDatum(SvPV(perlret, PL_na)), + ObjectIdGetDatum(prodesc->result_typioparam), + Int32GetDatum(-1)); } @@ -1159,9 +1161,10 @@ plperl_trigger_handler(PG_FUNCTION_ARGS) /************************************************************ * Call the Perl function ************************************************************/ + /* - * call perl trigger function and build TD hash - */ + * call perl trigger function and build TD hash + */ svTD = plperl_trigger_build_args(fcinfo); perlret = plperl_call_perl_trigger_func(prodesc, fcinfo, svTD); @@ -1386,9 +1389,9 @@ compile_plperl_function(Oid fn_oid, bool is_trigger) if (typeStruct->typtype == 'c' || procStruct->prorettype == RECORDOID) { prodesc->fn_retistuple = true; - prodesc->ret_oid = - procStruct->prorettype == RECORDOID ? - typeStruct->typrelid : + prodesc->ret_oid = + procStruct->prorettype == RECORDOID ? + typeStruct->typrelid : procStruct->prorettype; } @@ -1547,7 +1550,7 @@ plperl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc) ************************************************************/ outputstr = DatumGetCString(OidFunctionCall3(typoutput, attr, - ObjectIdGetDatum(typioparam), + ObjectIdGetDatum(typioparam), Int32GetDatum(tupdesc->attrs[i]->atttypmod))); sv_catpvf(output, "'%s' => '%s',", attname, outputstr); pfree(outputstr); diff --git a/src/pl/plperl/ppport.h b/src/pl/plperl/ppport.h index 0b949b5f77c..5e1d0846ba3 100644 --- a/src/pl/plperl/ppport.h +++ b/src/pl/plperl/ppport.h @@ -1,7 +1,7 @@ -/* ppport.h -- Perl/Pollution/Portability Version 2.011 +/* ppport.h -- Perl/Pollution/Portability Version 2.011 * - * Automatically Created by Devel::PPPort on Sun Jul 4 09:11:52 2004 + * Automatically Created by Devel::PPPort on Sun Jul 4 09:11:52 2004 * * Do NOT edit this file directly! -- Edit PPPort.pm instead. * @@ -9,7 +9,7 @@ * Version 1.x, Copyright (C) 1999, Kenneth Albanowski. * This code may be used and distributed under the same license as any * version of Perl. - * + * * This version of ppport.h is designed to support operation with Perl * installations back to 5.004, and has been tested up to 5.8.1. * @@ -22,20 +22,20 @@ * * Include all following information: * - * 1. The complete output from running "perl -V" + * 1. The complete output from running "perl -V" * - * 2. This file. + * 2. This file. * - * 3. The name & version of the module you were trying to build. + * 3. The name & version of the module you were trying to build. * - * 4. A full log of the build that failed. + * 4. A full log of the build that failed. * - * 5. Any other information that you think could be relevant. + * 5. Any other information that you think could be relevant. * * * For the latest version of this code, please retreive the Devel::PPPort * module from CPAN. - * + * */ /* @@ -53,29 +53,29 @@ * for a static include, or use the GLOBAL request in a single module to * produce a global definition that can be referenced from the other * modules. - * - * Function: Static define: Extern define: - * newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL + * + * Function: Static define: Extern define: + * newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL * */ - + /* To verify whether ppport.h is needed for your module, and whether any * special defines should be used, ppport.h can be run through Perl to check * your source code. Simply say: - * - * perl -x ppport.h *.c *.h *.xs foo/bar*.c [etc] - * + * + * perl -x ppport.h *.c *.h *.xs foo/bar*.c [etc] + * * The result will be a list of patches suggesting changes that should at * least be acceptable, if not necessarily the most efficient solution, or a * fix for all possible problems. It won't catch where dTHR is needed, and * doesn't attempt to account for global macro or function definitions, * nested includes, typemaps, etc. - * + * * In order to test for the need of dTHR, please try your module under a * recent version of Perl that has threading compiled-in. * - */ + */ /* @@ -133,11 +133,11 @@ foreach $filename (map(glob($_),@ARGV)) { $need_include = 1; } } - + if (scalar(keys %add_func) or $need_include != $has_include) { if (!$has_include) { $inc = join('',map("#define NEED_$_\n", sort keys %add_func)). - "#include \"ppport.h\"\n"; + "#include \"ppport.h\"\n"; $c = "$inc$c" unless $c =~ s/#.*include.*XSUB.*\n/$&$inc/m; } elsif (keys %add_func) { $inc = join('',map("#define NEED_$_\n", sort keys %add_func)); @@ -149,7 +149,7 @@ foreach $filename (map(glob($_),@ARGV)) { } $changes++; } - + if ($changes) { open(OUT,">/tmp/ppport.h.$$"); print OUT $c; @@ -169,192 +169,194 @@ __DATA__ #define _P_P_PORTABILITY_H_ #ifndef PERL_REVISION -# ifndef __PATCHLEVEL_H_INCLUDED__ -# define PERL_PATCHLEVEL_H_IMPLICIT -# include <patchlevel.h> -# endif -# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) -# include <could_not_find_Perl_patchlevel.h> -# endif -# ifndef PERL_REVISION -# define PERL_REVISION (5) - /* Replace: 1 */ -# define PERL_VERSION PATCHLEVEL -# define PERL_SUBVERSION SUBVERSION - /* Replace PERL_PATCHLEVEL with PERL_VERSION */ - /* Replace: 0 */ -# endif +#ifndef __PATCHLEVEL_H_INCLUDED__ +#define PERL_PATCHLEVEL_H_IMPLICIT +#include <patchlevel.h> +#endif +#if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) +#include <could_not_find_Perl_patchlevel.h> +#endif +#ifndef PERL_REVISION +#define PERL_REVISION (5) + /* Replace: 1 */ +#define PERL_VERSION PATCHLEVEL +#define PERL_SUBVERSION SUBVERSION + /* Replace PERL_PATCHLEVEL with PERL_VERSION */ + /* Replace: 0 */ +#endif #endif #define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION) -/* It is very unlikely that anyone will try to use this with Perl 6 +/* It is very unlikely that anyone will try to use this with Perl 6 (or greater), but who knows. */ #if PERL_REVISION != 5 -# error ppport.h only works with Perl version 5 -#endif /* PERL_REVISION != 5 */ +#error ppport.h only works with Perl version 5 +#endif /* PERL_REVISION != 5 */ #ifndef ERRSV -# define ERRSV perl_get_sv("@",FALSE) +#define ERRSV perl_get_sv("@",FALSE) #endif #if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)) /* Replace: 1 */ -# define PL_Sv Sv -# define PL_compiling compiling -# define PL_copline copline -# define PL_curcop curcop -# define PL_curstash curstash -# define PL_defgv defgv -# define PL_dirty dirty -# define PL_dowarn dowarn -# define PL_hints hints -# define PL_na na -# define PL_perldb perldb -# define PL_rsfp_filters rsfp_filters -# define PL_rsfpv rsfp -# define PL_stdingv stdingv -# define PL_sv_no sv_no -# define PL_sv_undef sv_undef -# define PL_sv_yes sv_yes +#define PL_Sv Sv +#define PL_compiling compiling +#define PL_copline copline +#define PL_curcop curcop +#define PL_curstash curstash +#define PL_defgv defgv +#define PL_dirty dirty +#define PL_dowarn dowarn +#define PL_hints hints +#define PL_na na +#define PL_perldb perldb +#define PL_rsfp_filters rsfp_filters +#define PL_rsfpv rsfp +#define PL_stdingv stdingv +#define PL_sv_no sv_no +#define PL_sv_undef sv_undef +#define PL_sv_yes sv_yes /* Replace: 0 */ #endif #ifdef HASATTRIBUTE -# if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER) -# define PERL_UNUSED_DECL -# else -# define PERL_UNUSED_DECL __attribute__((unused)) -# endif +#if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER) +#define PERL_UNUSED_DECL +#else +#define PERL_UNUSED_DECL __attribute__((unused)) +#endif #else -# define PERL_UNUSED_DECL +#define PERL_UNUSED_DECL #endif #ifndef dNOOP -# define NOOP (void)0 -# define dNOOP extern int Perl___notused PERL_UNUSED_DECL +#define NOOP (void)0 +#define dNOOP extern int Perl___notused PERL_UNUSED_DECL #endif #ifndef dTHR -# define dTHR dNOOP +#define dTHR dNOOP #endif #ifndef dTHX -# define dTHX dNOOP -# define dTHXa(x) dNOOP -# define dTHXoa(x) dNOOP +#define dTHX dNOOP +#define dTHXa(x) dNOOP +#define dTHXoa(x) dNOOP #endif #ifndef pTHX -# define pTHX void -# define pTHX_ -# define aTHX -# define aTHX_ -#endif +#define pTHX void +#define pTHX_ +#define aTHX +#define aTHX_ +#endif #ifndef dAX -# define dAX I32 ax = MARK - PL_stack_base + 1 +#define dAX I32 ax = MARK - PL_stack_base + 1 #endif #ifndef dITEMS -# define dITEMS I32 items = SP - MARK +#define dITEMS I32 items = SP - MARK #endif /* IV could also be a quad (say, a long long), but Perls * capable of those should have IVSIZE already. */ #if !defined(IVSIZE) && defined(LONGSIZE) -# define IVSIZE LONGSIZE +#define IVSIZE LONGSIZE #endif #ifndef IVSIZE -# define IVSIZE 4 /* A bold guess, but the best we can make. */ +#define IVSIZE 4 /* A bold guess, but the best we can make. */ #endif #ifndef UVSIZE -# define UVSIZE IVSIZE +#define UVSIZE IVSIZE #endif #ifndef NVTYPE -# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) -# define NVTYPE long double -# else -# define NVTYPE double -# endif +#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) +#define NVTYPE long double +#else +#define NVTYPE double +#endif typedef NVTYPE NV; #endif #ifndef INT2PTR #if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) -# define PTRV UV -# define INT2PTR(any,d) (any)(d) +#define PTRV UV +#define INT2PTR(any,d) (any)(d) #else -# if PTRSIZE == LONGSIZE -# define PTRV unsigned long -# else -# define PTRV unsigned -# endif -# define INT2PTR(any,d) (any)(PTRV)(d) -#endif -#define NUM2PTR(any,d) (any)(PTRV)(d) -#define PTR2IV(p) INT2PTR(IV,p) -#define PTR2UV(p) INT2PTR(UV,p) -#define PTR2NV(p) NUM2PTR(NV,p) #if PTRSIZE == LONGSIZE -# define PTR2ul(p) (unsigned long)(p) +#define PTRV unsigned long #else -# define PTR2ul(p) INT2PTR(unsigned long,p) +#define PTRV unsigned #endif - -#endif /* !INT2PTR */ +#define INT2PTR(any,d) (any)(PTRV)(d) +#endif +#define NUM2PTR(any,d) (any)(PTRV)(d) +#define PTR2IV(p) INT2PTR(IV,p) +#define PTR2UV(p) INT2PTR(UV,p) +#define PTR2NV(p) NUM2PTR(NV,p) +#if PTRSIZE == LONGSIZE +#define PTR2ul(p) (unsigned long)(p) +#else +#define PTR2ul(p) INT2PTR(unsigned long,p) +#endif +#endif /* !INT2PTR */ #ifndef boolSV -# define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no) +#define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no) #endif #ifndef gv_stashpvn -# define gv_stashpvn(str,len,flags) gv_stashpv(str,flags) +#define gv_stashpvn(str,len,flags) gv_stashpv(str,flags) #endif #ifndef newSVpvn -# define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0)) +#define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0)) #endif #ifndef newRV_inc /* Replace: 1 */ -# define newRV_inc(sv) newRV(sv) +#define newRV_inc(sv) newRV(sv) /* Replace: 0 */ #endif /* DEFSV appears first in 5.004_56 */ #ifndef DEFSV -# define DEFSV GvSV(PL_defgv) +#define DEFSV GvSV(PL_defgv) #endif #ifndef SAVE_DEFSV -# define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv)) +#define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv)) #endif #ifndef newRV_noinc -# ifdef __GNUC__ -# define newRV_noinc(sv) \ - ({ \ - SV *nsv = (SV*)newRV(sv); \ - SvREFCNT_dec(sv); \ - nsv; \ - }) -# else -# if defined(USE_THREADS) -static SV * newRV_noinc (SV * sv) +#ifdef __GNUC__ +#define newRV_noinc(sv) \ + ({ \ + SV *nsv = (SV*)newRV(sv); \ + SvREFCNT_dec(sv); \ + nsv; \ + }) +#else +#if defined(USE_THREADS) +static SV * +newRV_noinc(SV * sv) { - SV *nsv = (SV*)newRV(sv); - SvREFCNT_dec(sv); - return nsv; + SV *nsv = (SV *) newRV(sv); + + SvREFCNT_dec(sv); + return nsv; } -# else -# define newRV_noinc(sv) \ - (PL_Sv=(SV*)newRV(sv), SvREFCNT_dec(sv), (SV*)PL_Sv) -# endif -# endif + +#else +#define newRV_noinc(sv) \ + (PL_Sv=(SV*)newRV(sv), SvREFCNT_dec(sv), (SV*)PL_Sv) +#endif +#endif #endif /* Provide: newCONSTSUB */ @@ -365,20 +367,21 @@ static SV * newRV_noinc (SV * sv) #if defined(NEED_newCONSTSUB) static #else -extern void newCONSTSUB(HV * stash, char * name, SV *sv); +extern void newCONSTSUB(HV * stash, char *name, SV * sv); #endif #if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL) void -newCONSTSUB(stash,name,sv) -HV *stash; -char *name; -SV *sv; +newCONSTSUB(stash, name, sv) +HV *stash; +char *name; +SV *sv; { - U32 oldhints = PL_hints; - HV *old_cop_stash = PL_curcop->cop_stash; - HV *old_curstash = PL_curstash; - line_t oldline = PL_curcop->cop_line; + U32 oldhints = PL_hints; + HV *old_cop_stash = PL_curcop->cop_stash; + HV *old_curstash = PL_curstash; + line_t oldline = PL_curcop->cop_line; + PL_curcop->cop_line = PL_copline; PL_hints &= ~HINT_BLOCK_SCOPE; @@ -388,22 +391,23 @@ SV *sv; newSUB( #if (PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22)) - /* before 5.003_22 */ - start_subparse(), + /* before 5.003_22 */ + start_subparse(), #else -# if (PERL_VERSION == 3) && (PERL_SUBVERSION == 22) - /* 5.003_22 */ - start_subparse(0), -# else - /* 5.003_23 onwards */ - start_subparse(FALSE, 0), -# endif +#if (PERL_VERSION == 3) && (PERL_SUBVERSION == 22) + /* 5.003_22 */ + start_subparse(0), +#else + /* 5.003_23 onwards */ + start_subparse(FALSE, 0), +#endif #endif - newSVOP(OP_CONST, 0, newSVpv(name,0)), - newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&PL_sv_no) == "" -- GMB */ - newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) - ); + newSVOP(OP_CONST, 0, newSVpv(name, 0)), + newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&PL_sv_no) == "" + * -- GMB */ + newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) + ); PL_hints = oldhints; PL_curcop->cop_stash = old_cop_stash; @@ -411,8 +415,7 @@ SV *sv; PL_curcop->cop_line = oldline; } #endif - -#endif /* newCONSTSUB */ +#endif /* newCONSTSUB */ #ifndef START_MY_CXT @@ -425,18 +428,18 @@ SV *sv; * Code that uses these macros is responsible for the following: * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts" * 2. Declare a typedef named my_cxt_t that is a structure that contains - * all the data that needs to be interpreter-local. + * all the data that needs to be interpreter-local. * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t. * 4. Use the MY_CXT_INIT macro such that it is called exactly once - * (typically put in the BOOT: section). + * (typically put in the BOOT: section). * 5. Use the members of the my_cxt_t structure everywhere as - * MY_CXT.member. + * MY_CXT.member. * 6. Use the dMY_CXT macro (a declaration) in all the functions that - * access MY_CXT. + * access MY_CXT. */ #if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \ - defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT) + defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT) /* This must appear in all extensions that define a my_cxt_t structure, * right after the definition (i.e. at file scope). The non-threads @@ -447,15 +450,15 @@ SV *sv; /* Fetches the SV that keeps the per-interpreter data. */ #define dMY_CXT_SV \ SV *my_cxt_sv = perl_get_sv(MY_CXT_KEY, FALSE) -#else /* >= perl5.004_68 */ +#else /* >= perl5.004_68 */ #define dMY_CXT_SV \ SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \ sizeof(MY_CXT_KEY)-1, TRUE) -#endif /* < perl5.004_68 */ +#endif /* < perl5.004_68 */ /* This declaration should be used within all functions that use the * interpreter-local data. */ -#define dMY_CXT \ +#define dMY_CXT \ dMY_CXT_SV; \ my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv)) @@ -482,12 +485,12 @@ SV *sv; #define aMY_CXT_ aMY_CXT, #define _aMY_CXT ,aMY_CXT -#else /* single interpreter */ +#else /* single interpreter */ #define START_MY_CXT static my_cxt_t my_cxt; #define dMY_CXT_SV dNOOP #define dMY_CXT dNOOP -#define MY_CXT_INIT NOOP +#define MY_CXT_INIT NOOP #define MY_CXT my_cxt #define pMY_CXT void @@ -496,130 +499,129 @@ SV *sv; #define aMY_CXT #define aMY_CXT_ #define _aMY_CXT - -#endif - -#endif /* START_MY_CXT */ +#endif +#endif /* START_MY_CXT */ #ifndef IVdf -# if IVSIZE == LONGSIZE -# define IVdf "ld" -# define UVuf "lu" -# define UVof "lo" -# define UVxf "lx" -# define UVXf "lX" -# else -# if IVSIZE == INTSIZE -# define IVdf "d" -# define UVuf "u" -# define UVof "o" -# define UVxf "x" -# define UVXf "X" -# endif -# endif +#if IVSIZE == LONGSIZE +#define IVdf "ld" +#define UVuf "lu" +#define UVof "lo" +#define UVxf "lx" +#define UVXf "lX" +#else +#if IVSIZE == INTSIZE +#define IVdf "d" +#define UVuf "u" +#define UVof "o" +#define UVxf "x" +#define UVXf "X" +#endif +#endif #endif #ifndef NVef -# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \ - defined(PERL_PRIfldbl) /* Not very likely, but let's try anyway. */ -# define NVef PERL_PRIeldbl -# define NVff PERL_PRIfldbl -# define NVgf PERL_PRIgldbl -# else -# define NVef "e" -# define NVff "f" -# define NVgf "g" -# endif +#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \ + defined(PERL_PRIfldbl) /* Not very likely, but let's try anyway. */ +#define NVef PERL_PRIeldbl +#define NVff PERL_PRIfldbl +#define NVgf PERL_PRIgldbl +#else +#define NVef "e" +#define NVff "f" +#define NVgf "g" +#endif #endif -#ifndef AvFILLp /* Older perls (<=5.003) lack AvFILLp */ -# define AvFILLp AvFILL +#ifndef AvFILLp /* Older perls (<=5.003) lack AvFILLp */ +#define AvFILLp AvFILL #endif #ifdef SvPVbyte -# if PERL_REVISION == 5 && PERL_VERSION < 7 - /* SvPVbyte does not work in perl-5.6.1, borrowed version for 5.7.3 */ -# undef SvPVbyte -# define SvPVbyte(sv, lp) \ - ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \ - ? ((lp = SvCUR(sv)), SvPVX(sv)) : my_sv_2pvbyte(aTHX_ sv, &lp)) - static char * - my_sv_2pvbyte(pTHX_ register SV *sv, STRLEN *lp) - { - sv_utf8_downgrade(sv,0); - return SvPV(sv,*lp); - } -# endif +#if PERL_REVISION == 5 && PERL_VERSION < 7 + /* SvPVbyte does not work in perl-5.6.1, borrowed version for 5.7.3 */ +#undef SvPVbyte +#define SvPVbyte(sv, lp) \ + ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \ + ? ((lp = SvCUR(sv)), SvPVX(sv)) : my_sv_2pvbyte(aTHX_ sv, &lp)) +static char * +my_sv_2pvbyte(pTHX_ register SV * sv, STRLEN * lp) +{ + sv_utf8_downgrade(sv, 0); + return SvPV(sv, *lp); +} +#endif #else -# define SvPVbyte SvPV +#define SvPVbyte SvPV #endif #ifndef SvPV_nolen -# define SvPV_nolen(sv) \ - ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ - ? SvPVX(sv) : sv_2pv_nolen(sv)) - static char * - sv_2pv_nolen(pTHX_ register SV *sv) - { - STRLEN n_a; - return sv_2pv(sv, &n_a); - } +#define SvPV_nolen(sv) \ + ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ + ? SvPVX(sv) : sv_2pv_nolen(sv)) +static char * +sv_2pv_nolen(pTHX_ register SV * sv) +{ + STRLEN n_a; + + return sv_2pv(sv, &n_a); +} #endif #ifndef get_cv -# define get_cv(name,create) perl_get_cv(name,create) +#define get_cv(name,create) perl_get_cv(name,create) #endif #ifndef get_sv -# define get_sv(name,create) perl_get_sv(name,create) +#define get_sv(name,create) perl_get_sv(name,create) #endif #ifndef get_av -# define get_av(name,create) perl_get_av(name,create) +#define get_av(name,create) perl_get_av(name,create) #endif #ifndef get_hv -# define get_hv(name,create) perl_get_hv(name,create) +#define get_hv(name,create) perl_get_hv(name,create) #endif #ifndef call_argv -# define call_argv perl_call_argv +#define call_argv perl_call_argv #endif #ifndef call_method -# define call_method perl_call_method +#define call_method perl_call_method #endif #ifndef call_pv -# define call_pv perl_call_pv +#define call_pv perl_call_pv #endif #ifndef call_sv -# define call_sv perl_call_sv +#define call_sv perl_call_sv #endif #ifndef eval_pv -# define eval_pv perl_eval_pv +#define eval_pv perl_eval_pv #endif #ifndef eval_sv -# define eval_sv perl_eval_sv +#define eval_sv perl_eval_sv #endif #ifndef PERL_SCAN_GREATER_THAN_UV_MAX -# define PERL_SCAN_GREATER_THAN_UV_MAX 0x02 +#define PERL_SCAN_GREATER_THAN_UV_MAX 0x02 #endif #ifndef PERL_SCAN_SILENT_ILLDIGIT -# define PERL_SCAN_SILENT_ILLDIGIT 0x04 +#define PERL_SCAN_SILENT_ILLDIGIT 0x04 #endif #ifndef PERL_SCAN_ALLOW_UNDERSCORES -# define PERL_SCAN_ALLOW_UNDERSCORES 0x01 +#define PERL_SCAN_ALLOW_UNDERSCORES 0x01 #endif #ifndef PERL_SCAN_DISALLOW_PREFIX -# define PERL_SCAN_DISALLOW_PREFIX 0x02 +#define PERL_SCAN_DISALLOW_PREFIX 0x02 #endif #if (PERL_VERSION > 6) || ((PERL_VERSION == 6) && (PERL_SUBVERSION >= 1)) @@ -630,184 +632,183 @@ SV *sv; #ifndef IN_LOCALE -# define IN_LOCALE \ +#define IN_LOCALE \ (PL_curcop == &PL_compiling ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME) #endif #ifndef IN_LOCALE_RUNTIME -# define IN_LOCALE_RUNTIME (PL_curcop->op_private & HINT_LOCALE) +#define IN_LOCALE_RUNTIME (PL_curcop->op_private & HINT_LOCALE) #endif #ifndef IN_LOCALE_COMPILETIME -# define IN_LOCALE_COMPILETIME (PL_hints & HINT_LOCALE) +#define IN_LOCALE_COMPILETIME (PL_hints & HINT_LOCALE) #endif #ifndef IS_NUMBER_IN_UV -# define IS_NUMBER_IN_UV 0x01 -# define IS_NUMBER_GREATER_THAN_UV_MAX 0x02 -# define IS_NUMBER_NOT_INT 0x04 -# define IS_NUMBER_NEG 0x08 -# define IS_NUMBER_INFINITY 0x10 -# define IS_NUMBER_NAN 0x20 +#define IS_NUMBER_IN_UV 0x01 +#define IS_NUMBER_GREATER_THAN_UV_MAX 0x02 +#define IS_NUMBER_NOT_INT 0x04 +#define IS_NUMBER_NEG 0x08 +#define IS_NUMBER_INFINITY 0x10 +#define IS_NUMBER_NAN 0x20 #endif #ifndef PERL_MAGIC_sv -# define PERL_MAGIC_sv '\0' +#define PERL_MAGIC_sv '\0' #endif #ifndef PERL_MAGIC_overload -# define PERL_MAGIC_overload 'A' +#define PERL_MAGIC_overload 'A' #endif #ifndef PERL_MAGIC_overload_elem -# define PERL_MAGIC_overload_elem 'a' +#define PERL_MAGIC_overload_elem 'a' #endif #ifndef PERL_MAGIC_overload_table -# define PERL_MAGIC_overload_table 'c' +#define PERL_MAGIC_overload_table 'c' #endif #ifndef PERL_MAGIC_bm -# define PERL_MAGIC_bm 'B' +#define PERL_MAGIC_bm 'B' #endif #ifndef PERL_MAGIC_regdata -# define PERL_MAGIC_regdata 'D' +#define PERL_MAGIC_regdata 'D' #endif #ifndef PERL_MAGIC_regdatum -# define PERL_MAGIC_regdatum 'd' +#define PERL_MAGIC_regdatum 'd' #endif #ifndef PERL_MAGIC_env -# define PERL_MAGIC_env 'E' +#define PERL_MAGIC_env 'E' #endif #ifndef PERL_MAGIC_envelem -# define PERL_MAGIC_envelem 'e' +#define PERL_MAGIC_envelem 'e' #endif #ifndef PERL_MAGIC_fm -# define PERL_MAGIC_fm 'f' +#define PERL_MAGIC_fm 'f' #endif #ifndef PERL_MAGIC_regex_global -# define PERL_MAGIC_regex_global 'g' +#define PERL_MAGIC_regex_global 'g' #endif #ifndef PERL_MAGIC_isa -# define PERL_MAGIC_isa 'I' +#define PERL_MAGIC_isa 'I' #endif #ifndef PERL_MAGIC_isaelem -# define PERL_MAGIC_isaelem 'i' +#define PERL_MAGIC_isaelem 'i' #endif #ifndef PERL_MAGIC_nkeys -# define PERL_MAGIC_nkeys 'k' +#define PERL_MAGIC_nkeys 'k' #endif #ifndef PERL_MAGIC_dbfile -# define PERL_MAGIC_dbfile 'L' +#define PERL_MAGIC_dbfile 'L' #endif #ifndef PERL_MAGIC_dbline -# define PERL_MAGIC_dbline 'l' +#define PERL_MAGIC_dbline 'l' #endif #ifndef PERL_MAGIC_mutex -# define PERL_MAGIC_mutex 'm' +#define PERL_MAGIC_mutex 'm' #endif #ifndef PERL_MAGIC_shared -# define PERL_MAGIC_shared 'N' +#define PERL_MAGIC_shared 'N' #endif #ifndef PERL_MAGIC_shared_scalar -# define PERL_MAGIC_shared_scalar 'n' +#define PERL_MAGIC_shared_scalar 'n' #endif #ifndef PERL_MAGIC_collxfrm -# define PERL_MAGIC_collxfrm 'o' +#define PERL_MAGIC_collxfrm 'o' #endif #ifndef PERL_MAGIC_tied -# define PERL_MAGIC_tied 'P' +#define PERL_MAGIC_tied 'P' #endif #ifndef PERL_MAGIC_tiedelem -# define PERL_MAGIC_tiedelem 'p' +#define PERL_MAGIC_tiedelem 'p' #endif #ifndef PERL_MAGIC_tiedscalar -# define PERL_MAGIC_tiedscalar 'q' +#define PERL_MAGIC_tiedscalar 'q' #endif #ifndef PERL_MAGIC_qr -# define PERL_MAGIC_qr 'r' +#define PERL_MAGIC_qr 'r' #endif #ifndef PERL_MAGIC_sig -# define PERL_MAGIC_sig 'S' +#define PERL_MAGIC_sig 'S' #endif #ifndef PERL_MAGIC_sigelem -# define PERL_MAGIC_sigelem 's' +#define PERL_MAGIC_sigelem 's' #endif #ifndef PERL_MAGIC_taint -# define PERL_MAGIC_taint 't' +#define PERL_MAGIC_taint 't' #endif #ifndef PERL_MAGIC_uvar -# define PERL_MAGIC_uvar 'U' +#define PERL_MAGIC_uvar 'U' #endif #ifndef PERL_MAGIC_uvar_elem -# define PERL_MAGIC_uvar_elem 'u' +#define PERL_MAGIC_uvar_elem 'u' #endif #ifndef PERL_MAGIC_vstring -# define PERL_MAGIC_vstring 'V' +#define PERL_MAGIC_vstring 'V' #endif #ifndef PERL_MAGIC_vec -# define PERL_MAGIC_vec 'v' +#define PERL_MAGIC_vec 'v' #endif #ifndef PERL_MAGIC_utf8 -# define PERL_MAGIC_utf8 'w' +#define PERL_MAGIC_utf8 'w' #endif #ifndef PERL_MAGIC_substr -# define PERL_MAGIC_substr 'x' +#define PERL_MAGIC_substr 'x' #endif #ifndef PERL_MAGIC_defelem -# define PERL_MAGIC_defelem 'y' +#define PERL_MAGIC_defelem 'y' #endif #ifndef PERL_MAGIC_glob -# define PERL_MAGIC_glob '*' +#define PERL_MAGIC_glob '*' #endif #ifndef PERL_MAGIC_arylen -# define PERL_MAGIC_arylen '#' +#define PERL_MAGIC_arylen '#' #endif #ifndef PERL_MAGIC_pos -# define PERL_MAGIC_pos '.' +#define PERL_MAGIC_pos '.' #endif #ifndef PERL_MAGIC_backref -# define PERL_MAGIC_backref '<' +#define PERL_MAGIC_backref '<' #endif #ifndef PERL_MAGIC_ext -# define PERL_MAGIC_ext '~' +#define PERL_MAGIC_ext '~' #endif - -#endif /* _P_P_PORTABILITY_H_ */ +#endif /* _P_P_PORTABILITY_H_ */ /* End of File ppport.h */ diff --git a/src/pl/plperl/spi_internal.c b/src/pl/plperl/spi_internal.c index 8d17af5b542..5c3bb38a534 100644 --- a/src/pl/plperl/spi_internal.c +++ b/src/pl/plperl/spi_internal.c @@ -9,7 +9,7 @@ #include "spi_internal.h" -static HV* plperl_spi_execute_fetch_result(SPITupleTable*, int, int ); +static HV *plperl_spi_execute_fetch_result(SPITupleTable *, int, int); int @@ -48,30 +48,31 @@ spi_ERROR(void) return ERROR; } -HV* -plperl_spi_exec(char* query, int limit) +HV * +plperl_spi_exec(char *query, int limit) { - HV *ret_hv; - int spi_rv; + HV *ret_hv; + int spi_rv; spi_rv = SPI_exec(query, limit); - ret_hv=plperl_spi_execute_fetch_result(SPI_tuptable, SPI_processed, spi_rv); + ret_hv = plperl_spi_execute_fetch_result(SPI_tuptable, SPI_processed, spi_rv); return ret_hv; } -static HV* +static HV * plperl_hash_from_tuple(HeapTuple tuple, TupleDesc tupdesc) { - int i; - char *attname; - char *attdata; + int i; + char *attname; + char *attdata; - HV *array; + HV *array; array = newHV(); - for (i = 0; i < tupdesc->natts; i++) { + for (i = 0; i < tupdesc->natts; i++) + { /************************************************************ * Get the attribute name ************************************************************/ @@ -80,24 +81,24 @@ plperl_hash_from_tuple(HeapTuple tuple, TupleDesc tupdesc) /************************************************************ * Get the attributes value ************************************************************/ - attdata = SPI_getvalue(tuple, tupdesc, i+1); - if(attdata) - hv_store(array, attname, strlen(attname), newSVpv(attdata,0), 0); + attdata = SPI_getvalue(tuple, tupdesc, i + 1); + if (attdata) + hv_store(array, attname, strlen(attname), newSVpv(attdata, 0), 0); else - hv_store(array, attname, strlen(attname), newSVpv("undef",0), 0); + hv_store(array, attname, strlen(attname), newSVpv("undef", 0), 0); } return array; } -static HV* +static HV * plperl_spi_execute_fetch_result(SPITupleTable *tuptable, int processed, int status) { - HV *result; + HV *result; result = newHV(); hv_store(result, "status", strlen("status"), - newSVpv((char*)SPI_result_code_string(status),0), 0); + newSVpv((char *) SPI_result_code_string(status), 0), 0); hv_store(result, "processed", strlen("processed"), newSViv(processed), 0); @@ -105,18 +106,18 @@ plperl_spi_execute_fetch_result(SPITupleTable *tuptable, int processed, int stat { if (processed) { - AV *rows; - HV *row; - int i; + AV *rows; + HV *row; + int i; rows = newAV(); for (i = 0; i < processed; i++) { row = plperl_hash_from_tuple(tuptable->vals[i], tuptable->tupdesc); - av_store(rows, i, newRV_noinc((SV*)row)); + av_store(rows, i, newRV_noinc((SV *) row)); } hv_store(result, "rows", strlen("rows"), - newRV_noinc((SV*)rows), 0); + newRV_noinc((SV *) rows), 0); } } diff --git a/src/pl/plperl/spi_internal.h b/src/pl/plperl/spi_internal.h index 5b5143d6588..1f1984a1570 100644 --- a/src/pl/plperl/spi_internal.h +++ b/src/pl/plperl/spi_internal.h @@ -15,6 +15,4 @@ int spi_WARNING(void); int spi_ERROR(void); -HV* plperl_spi_exec(char*, int); - - +HV *plperl_spi_exec(char *, int); |