summaryrefslogtreecommitdiff
path: root/src/pl
diff options
context:
space:
mode:
authorBruce Momjian2010-07-06 19:19:02 +0000
committerBruce Momjian2010-07-06 19:19:02 +0000
commit239d769e7e05e0a5ef3bd6828e93e22ef3962780 (patch)
tree9660987f1372651b78fb82023739728f2f962a6e /src/pl
parent52783b212c7c0ef5ab2ee6bda17c8db0ed13d4ab (diff)
pgindent run for 9.0, second run
Diffstat (limited to 'src/pl')
-rw-r--r--src/pl/plperl/plperl.c163
-rw-r--r--src/pl/plpgsql/src/pl_exec.c12
-rw-r--r--src/pl/plpython/plpython.c4
-rw-r--r--src/pl/tcl/pltcl.c4
4 files changed, 96 insertions, 87 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 7d62caa4692..ff46d2c2854 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -1,7 +1,7 @@
/**********************************************************************
* plperl.c - perl as a procedural language for PostgreSQL
*
- * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.178 2010/06/29 04:12:47 petere Exp $
+ * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.179 2010/07/06 19:19:01 momjian Exp $
*
**********************************************************************/
@@ -185,6 +185,7 @@ static void plperl_inline_callback(void *arg);
static char *strip_trailing_ws(const char *msg);
static OP *pp_require_safe(pTHX);
static int restore_context(bool);
+
#ifdef WIN32
static char *setlocale_perl(int category, char *locale);
#endif
@@ -241,7 +242,8 @@ _PG_init(void)
*
* If initialization fails due to, e.g., plperl_init_interp() throwing an
* exception, then we'll return here on the next usage and the user will
- * get a rather cryptic: ERROR: attempt to redefine parameter "plperl.use_strict"
+ * get a rather cryptic: ERROR: attempt to redefine parameter
+ * "plperl.use_strict"
*/
static bool inited = false;
HASHCTL hash_ctl;
@@ -536,7 +538,6 @@ plperl_init_interp(void)
STMT_START { \
if (saved != NULL) { setlocale_perl(name, saved); pfree(saved); } \
} STMT_END
-
#endif
if (plperl_on_init)
@@ -579,17 +580,19 @@ plperl_init_interp(void)
/*
* Record the original function for the 'require' and 'dofile' opcodes.
- * (They share the same implementation.) Ensure it's used for new interpreters.
+ * (They share the same implementation.) Ensure it's used for new
+ * interpreters.
*/
if (!pp_require_orig)
pp_require_orig = PL_ppaddr[OP_REQUIRE];
- else
+ else
{
PL_ppaddr[OP_REQUIRE] = pp_require_orig;
- PL_ppaddr[OP_DOFILE] = pp_require_orig;
+ PL_ppaddr[OP_DOFILE] = pp_require_orig;
}
#ifdef PLPERL_ENABLE_OPMASK_EARLY
+
/*
* For regression testing to prove that the PLC_PERLBOOT and PLC_TRUSTED
* code doesn't even compile any unsafe ops. In future there may be a
@@ -611,11 +614,11 @@ plperl_init_interp(void)
errcontext("while running Perl initialization")));
#ifdef PLPERL_RESTORE_LOCALE
- PLPERL_RESTORE_LOCALE(LC_COLLATE, save_collate);
- PLPERL_RESTORE_LOCALE(LC_CTYPE, save_ctype);
+ PLPERL_RESTORE_LOCALE(LC_COLLATE, save_collate);
+ PLPERL_RESTORE_LOCALE(LC_CTYPE, save_ctype);
PLPERL_RESTORE_LOCALE(LC_MONETARY, save_monetary);
- PLPERL_RESTORE_LOCALE(LC_NUMERIC, save_numeric);
- PLPERL_RESTORE_LOCALE(LC_TIME, save_time);
+ PLPERL_RESTORE_LOCALE(LC_NUMERIC, save_numeric);
+ PLPERL_RESTORE_LOCALE(LC_TIME, save_time);
#endif
return plperl;
@@ -693,27 +696,27 @@ plperl_destroy_interp(PerlInterpreter **interp)
static void
plperl_trusted_init(void)
{
- HV *stash;
- SV *sv;
- char *key;
- I32 klen;
-
+ HV *stash;
+ SV *sv;
+ char *key;
+ I32 klen;
+
/* use original require while we set up */
PL_ppaddr[OP_REQUIRE] = pp_require_orig;
PL_ppaddr[OP_DOFILE] = pp_require_orig;
-
+
eval_pv(PLC_TRUSTED, FALSE);
if (SvTRUE(ERRSV))
ereport(ERROR,
(errmsg("%s", strip_trailing_ws(SvPV_nolen(ERRSV))),
errcontext("while executing PLC_TRUSTED")));
-
+
if (GetDatabaseEncoding() == PG_UTF8)
{
/*
- * Force loading of utf8 module now to prevent errors that can
- * arise from the regex code later trying to load utf8 modules.
- * See http://rt.perl.org/rt3/Ticket/Display.html?id=47576
+ * Force loading of utf8 module now to prevent errors that can arise
+ * from the regex code later trying to load utf8 modules. See
+ * http://rt.perl.org/rt3/Ticket/Display.html?id=47576
*/
eval_pv("my $a=chr(0x100); return $a =~ /\\xa9/i", FALSE);
if (SvTRUE(ERRSV))
@@ -721,37 +724,37 @@ plperl_trusted_init(void)
(errmsg("%s", strip_trailing_ws(SvPV_nolen(ERRSV))),
errcontext("while executing utf8fix")));
}
-
+
/*
* Lock down the interpreter
*/
-
+
/* switch to the safe require/dofile opcode for future code */
PL_ppaddr[OP_REQUIRE] = pp_require_safe;
- PL_ppaddr[OP_DOFILE] = pp_require_safe;
-
- /*
- * prevent (any more) unsafe opcodes being compiled
- * PL_op_mask is per interpreter, so this only needs to be set once
+ PL_ppaddr[OP_DOFILE] = pp_require_safe;
+
+ /*
+ * prevent (any more) unsafe opcodes being compiled PL_op_mask is per
+ * interpreter, so this only needs to be set once
*/
PL_op_mask = plperl_opmask;
-
+
/* delete the DynaLoader:: namespace so extensions can't be loaded */
stash = gv_stashpv("DynaLoader", GV_ADDWARN);
hv_iterinit(stash);
- while ((sv = hv_iternextsv(stash, &key, &klen)))
+ while ((sv = hv_iternextsv(stash, &key, &klen)))
{
if (!isGV_with_GP(sv) || !GvCV(sv))
continue;
SvREFCNT_dec(GvCV(sv)); /* free the CV */
- GvCV(sv) = NULL; /* prevent call via GV */
+ GvCV(sv) = NULL; /* prevent call via GV */
}
hv_clear(stash);
-
+
/* invalidate assorted caches */
++PL_sub_generation;
hv_clear(PL_stashcache);
-
+
/*
* Execute plperl.on_plperl_init in the locked-down interpreter
*/
@@ -762,7 +765,7 @@ plperl_trusted_init(void)
ereport(ERROR,
(errmsg("%s", strip_trailing_ws(SvPV_nolen(ERRSV))),
errcontext("while executing plperl.on_plperl_init")));
-
+
}
}
@@ -1316,11 +1319,11 @@ plperl_create_sub(plperl_proc_desc *prodesc, char *s, Oid fn_oid)
if (!subref)
ereport(ERROR,
- (errmsg("didn't get a CODE reference from compiling function \"%s\"",
- prodesc->proname)));
-
+ (errmsg("didn't get a CODE reference from compiling function \"%s\"",
+ prodesc->proname)));
+
prodesc->reference = subref;
-
+
return;
}
@@ -3055,62 +3058,68 @@ plperl_inline_callback(void *arg)
static char *
setlocale_perl(int category, char *locale)
{
- char *RETVAL = setlocale(category, locale);
- if (RETVAL) {
+ char *RETVAL = setlocale(category, locale);
+
+ if (RETVAL)
+ {
#ifdef USE_LOCALE_CTYPE
- if (category == LC_CTYPE
+ if (category == LC_CTYPE
#ifdef LC_ALL
- || category == LC_ALL
+ || category == LC_ALL
#endif
- )
- {
- char *newctype;
+ )
+ {
+ char *newctype;
+
#ifdef LC_ALL
- if (category == LC_ALL)
- newctype = setlocale(LC_CTYPE, NULL);
- else
+ if (category == LC_ALL)
+ newctype = setlocale(LC_CTYPE, NULL);
+ else
#endif
- newctype = RETVAL;
- new_ctype(newctype);
- }
-#endif /* USE_LOCALE_CTYPE */
+ newctype = RETVAL;
+ new_ctype(newctype);
+ }
+#endif /* USE_LOCALE_CTYPE */
#ifdef USE_LOCALE_COLLATE
- if (category == LC_COLLATE
+ if (category == LC_COLLATE
#ifdef LC_ALL
- || category == LC_ALL
+ || category == LC_ALL
#endif
- )
- {
- char *newcoll;
+ )
+ {
+ char *newcoll;
+
#ifdef LC_ALL
- if (category == LC_ALL)
- newcoll = setlocale(LC_COLLATE, NULL);
- else
+ if (category == LC_ALL)
+ newcoll = setlocale(LC_COLLATE, NULL);
+ else
#endif
- newcoll = RETVAL;
- new_collate(newcoll);
- }
-#endif /* USE_LOCALE_COLLATE */
+ newcoll = RETVAL;
+ new_collate(newcoll);
+ }
+#endif /* USE_LOCALE_COLLATE */
#ifdef USE_LOCALE_NUMERIC
- if (category == LC_NUMERIC
+ if (category == LC_NUMERIC
#ifdef LC_ALL
- || category == LC_ALL
+ || category == LC_ALL
#endif
- )
- {
- char *newnum;
+ )
+ {
+ char *newnum;
+
#ifdef LC_ALL
- if (category == LC_ALL)
- newnum = setlocale(LC_NUMERIC, NULL);
- else
+ if (category == LC_ALL)
+ newnum = setlocale(LC_NUMERIC, NULL);
+ else
#endif
- newnum = RETVAL;
- new_numeric(newnum);
- }
-#endif /* USE_LOCALE_NUMERIC */
- }
+ newnum = RETVAL;
+ new_numeric(newnum);
+ }
+#endif /* USE_LOCALE_NUMERIC */
+ }
- return RETVAL;
+ return RETVAL;
}
+
#endif
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index d1af4a6e5fb..e1f48e3d75d 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.260 2010/07/05 09:27:18 heikki Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.261 2010/07/06 19:19:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1899,7 +1899,7 @@ exec_stmt_forc(PLpgSQL_execstate *estate, PLpgSQL_stmt_forc *stmt)
{
PLpgSQL_var *curvar;
char *curname = NULL;
- const char *portalname;
+ const char *portalname;
PLpgSQL_expr *query;
ParamListInfo paramLI;
Portal portal;
@@ -3035,8 +3035,8 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate,
if (*ptr == 'S' || *ptr == 's')
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("EXECUTE of SELECT ... INTO is not implemented"),
- errhint("You might want to use EXECUTE ... INTO instead.")));
+ errmsg("EXECUTE of SELECT ... INTO is not implemented"),
+ errhint("You might want to use EXECUTE ... INTO instead.")));
break;
}
@@ -4292,8 +4292,8 @@ exec_for_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_forq *stmt,
elog(ERROR, "unsupported target");
/*
- * Make sure the portal doesn't get closed by the user statements
- * we execute.
+ * Make sure the portal doesn't get closed by the user statements we
+ * execute.
*/
PinPortal(portal);
diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index 8877809220c..d63ba4a40cb 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -1,7 +1,7 @@
/**********************************************************************
* plpython.c - python as a procedural language for PostgreSQL
*
- * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.145 2010/06/29 00:18:11 petere Exp $
+ * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.146 2010/07/06 19:19:01 momjian Exp $
*
*********************************************************************
*/
@@ -3013,7 +3013,7 @@ PLy_spi_execute_plan(PyObject *ob, PyObject *list, long limit)
PG_TRY();
{
plan->values[j] =
- plan->args[j].out.d.func(NULL, &(plan->args[j].out.d), elem);
+ plan->args[j].out.d.func(NULL, &(plan->args[j].out.d), elem);
}
PG_CATCH();
{
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index f0a70c8da6e..1d0d04d3d79 100644
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -2,7 +2,7 @@
* pltcl.c - PostgreSQL support for Tcl as
* procedural language (PL)
*
- * $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.133 2010/05/13 18:29:12 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.134 2010/07/06 19:19:01 momjian Exp $
*
**********************************************************************/
@@ -462,7 +462,7 @@ pltcl_init_load_unknown(Tcl_Interp *interp)
buflen = strlen(pmrelname) + 100;
buf = (char *) palloc(buflen);
snprintf(buf, buflen,
- "select modsrc from %s where modname = 'unknown' order by modseq",
+ "select modsrc from %s where modname = 'unknown' order by modseq",
pmrelname);
spi_rc = SPI_execute(buf, false, 0);