diff options
| author | Bruce Momjian | 2002-09-04 20:31:48 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2002-09-04 20:31:48 +0000 |
| commit | e50f52a074bdf0d6a9dc384840e641c4c0b0bb1a (patch) | |
| tree | ab73e8c8ec94a6ddc774c1f9c49b87aa6b93fd13 /src/pl | |
| parent | c91ceec21d357d6d857163d897ac75a79c883dee (diff) | |
pgindent run.
Diffstat (limited to 'src/pl')
| -rw-r--r-- | src/pl/plperl/eloglvl.c | 1 | ||||
| -rw-r--r-- | src/pl/plperl/eloglvl.h | 13 | ||||
| -rw-r--r-- | src/pl/plperl/plperl.c | 10 | ||||
| -rw-r--r-- | src/pl/plpgsql/src/pl_comp.c | 10 | ||||
| -rw-r--r-- | src/pl/plpgsql/src/pl_exec.c | 144 | ||||
| -rw-r--r-- | src/pl/plpgsql/src/pl_funcs.c | 15 | ||||
| -rw-r--r-- | src/pl/plpgsql/src/plpgsql.h | 4 | ||||
| -rw-r--r-- | src/pl/plpython/plpython.c | 86 | ||||
| -rw-r--r-- | src/pl/tcl/pltcl.c | 6 |
9 files changed, 150 insertions, 139 deletions
diff --git a/src/pl/plperl/eloglvl.c b/src/pl/plperl/eloglvl.c index a0da01a2f02..61c18b1e544 100644 --- a/src/pl/plperl/eloglvl.c +++ b/src/pl/plperl/eloglvl.c @@ -45,4 +45,3 @@ elog_ERROR(void) { return ERROR; } - diff --git a/src/pl/plperl/eloglvl.h b/src/pl/plperl/eloglvl.h index 742b5e6434b..5452586a926 100644 --- a/src/pl/plperl/eloglvl.h +++ b/src/pl/plperl/eloglvl.h @@ -1,13 +1,12 @@ -int elog_DEBUG(void); +int elog_DEBUG(void); -int elog_LOG(void); +int elog_LOG(void); -int elog_INFO(void); +int elog_INFO(void); -int elog_NOTICE(void); +int elog_NOTICE(void); -int elog_WARNING(void); - -int elog_ERROR(void); +int elog_WARNING(void); +int elog_ERROR(void); diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index c617c861141..8d94d28ee86 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -33,7 +33,7 @@ * ENHANCEMENTS, OR MODIFICATIONS. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.32 2002/08/22 00:01:49 tgl Exp $ + * $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.33 2002/09/04 20:31:47 momjian Exp $ * **********************************************************************/ @@ -341,8 +341,8 @@ plperl_create_sub(char *s, bool trusted) * **********************************************************************/ -EXTERN_C void boot_DynaLoader(pTHX_ CV* cv); -EXTERN_C void boot_SPI(pTHX_ CV* cv); +EXTERN_C void boot_DynaLoader(pTHX_ CV * cv); +EXTERN_C void boot_SPI(pTHX_ CV * cv); static void plperl_init_shared_libs(pTHX) @@ -553,7 +553,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger) * function's pg_proc entry without changing its OID. ************************************************************/ uptodate = (prodesc->fn_xmin == HeapTupleHeaderGetXmin(procTup->t_data) && - prodesc->fn_cmin == HeapTupleHeaderGetCmin(procTup->t_data)); + prodesc->fn_cmin == HeapTupleHeaderGetCmin(procTup->t_data)); if (!uptodate) { @@ -628,7 +628,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger) if (typeStruct->typtype == 'p') { if (procStruct->prorettype == VOIDOID) - /* okay */; + /* okay */ ; else if (procStruct->prorettype == TRIGGEROID || procStruct->prorettype == OPAQUEOID) { diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c index 2ee06acbe0b..c25f964f7c6 100644 --- a/src/pl/plpgsql/src/pl_comp.c +++ b/src/pl/plpgsql/src/pl_comp.c @@ -3,7 +3,7 @@ * procedural language * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.50 2002/09/01 16:28:06 tgl Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.51 2002/09/04 20:31:47 momjian Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -216,7 +216,7 @@ plpgsql_compile(Oid fn_oid, int functype) { if (procStruct->prorettype == VOIDOID || procStruct->prorettype == RECORDOID) - /* okay */; + /* okay */ ; else if (procStruct->prorettype == TRIGGEROID || procStruct->prorettype == OPAQUEOID) elog(ERROR, "plpgsql functions cannot return type %s" @@ -246,7 +246,7 @@ plpgsql_compile(Oid fn_oid, int functype) { char buf[32]; - snprintf(buf, sizeof(buf), "$%d", i + 1); /* name for variable */ + snprintf(buf, sizeof(buf), "$%d", i + 1); /* name for variable */ /* * Get the parameters type @@ -1138,7 +1138,7 @@ build_rowtype(Oid classOid) PLpgSQL_row *row; HeapTuple classtup; Form_pg_class classStruct; - const char *relname; + const char *relname; int i; /* @@ -1178,7 +1178,7 @@ build_rowtype(Oid classOid) Form_pg_attribute attrStruct; HeapTuple typetup; Form_pg_type typeStruct; - const char *attname; + const char *attname; PLpgSQL_var *var; /* diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index 7b7b1c1555e..37184b8af49 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -3,7 +3,7 @@ * procedural language * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.62 2002/09/01 16:28:06 tgl Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.63 2002/09/04 20:31:47 momjian Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -98,7 +98,7 @@ static int exec_stmt_exit(PLpgSQL_execstate * estate, static int exec_stmt_return(PLpgSQL_execstate * estate, PLpgSQL_stmt_return * stmt); static int exec_stmt_return_next(PLpgSQL_execstate * estate, - PLpgSQL_stmt_return_next * stmt); + PLpgSQL_stmt_return_next * stmt); static int exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt); static int exec_stmt_execsql(PLpgSQL_execstate * estate, @@ -108,9 +108,9 @@ static int exec_stmt_dynexecute(PLpgSQL_execstate * estate, static int exec_stmt_dynfors(PLpgSQL_execstate * estate, PLpgSQL_stmt_dynfors * stmt); -static void plpgsql_estate_setup(PLpgSQL_execstate *estate, - PLpgSQL_function *func, - ReturnSetInfo *rsi); +static void plpgsql_estate_setup(PLpgSQL_execstate * estate, + PLpgSQL_function * func, + ReturnSetInfo *rsi); static void exec_eval_cleanup(PLpgSQL_execstate * estate); static void exec_prepare_plan(PLpgSQL_execstate * estate, @@ -144,7 +144,7 @@ static Datum exec_cast_value(Datum value, Oid valtype, Oid reqtypelem, int32 reqtypmod, bool *isnull); -static void exec_init_tuple_store(PLpgSQL_execstate *estate); +static void exec_init_tuple_store(PLpgSQL_execstate * estate); static bool compatible_tupdesc(TupleDesc td1, TupleDesc td2); static void exec_set_found(PLpgSQL_execstate * estate, bool state); @@ -991,7 +991,8 @@ exec_stmt_assign(PLpgSQL_execstate * estate, PLpgSQL_stmt_assign * stmt) * depending on whether at least one row was returned). * * This cannot share code with the assignment case since we do not - * wish to constrain the discarded result to be only one row/column. + * wish to constrain the discarded result to be only one + * row/column. */ int rc; @@ -1248,7 +1249,7 @@ exec_stmt_fori(PLpgSQL_execstate * estate, PLpgSQL_stmt_fori * stmt) break; } - found = true; /* looped at least once */ + found = true; /* looped at least once */ /* * Execute the statements @@ -1256,7 +1257,7 @@ exec_stmt_fori(PLpgSQL_execstate * estate, PLpgSQL_stmt_fori * stmt) rc = exec_stmts(estate, stmt->body); if (rc == PLPGSQL_RC_RETURN) - break; /* return from function */ + break; /* return from function */ else if (rc == PLPGSQL_RC_EXIT) { if (estate->exitlabel == NULL) @@ -1271,9 +1272,9 @@ exec_stmt_fori(PLpgSQL_execstate * estate, PLpgSQL_stmt_fori * stmt) } /* - * otherwise, we processed a labelled exit that does not - * match the current statement's label, if any: return - * RC_EXIT so that the EXIT continues to recurse upward. + * otherwise, we processed a labelled exit that does not match + * the current statement's label, if any: return RC_EXIT so + * that the EXIT continues to recurse upward. */ break; @@ -1289,10 +1290,10 @@ exec_stmt_fori(PLpgSQL_execstate * estate, PLpgSQL_stmt_fori * stmt) } /* - * Set the FOUND variable to indicate the result of executing the - * loop (namely, whether we looped one or more times). This must be - * set here so that it does not interfere with the value of the - * FOUND variable inside the loop processing itself. + * Set the FOUND variable to indicate the result of executing the loop + * (namely, whether we looped one or more times). This must be set + * here so that it does not interfere with the value of the FOUND + * variable inside the loop processing itself. */ exec_set_found(estate, found); @@ -1346,7 +1347,7 @@ exec_stmt_fors(PLpgSQL_execstate * estate, PLpgSQL_stmt_fors * stmt) if (n == 0) exec_move_row(estate, rec, row, NULL, NULL); else - found = true; /* processed at least one tuple */ + found = true; /* processed at least one tuple */ /* * Now do the loop @@ -1388,9 +1389,10 @@ exec_stmt_fors(PLpgSQL_execstate * estate, PLpgSQL_stmt_fors * stmt) } /* - * otherwise, we processed a labelled exit that does not - * match the current statement's label, if any: return - * RC_EXIT so that the EXIT continues to recurse upward. + * otherwise, we processed a labelled exit that does + * not match the current statement's label, if any: + * return RC_EXIT so that the EXIT continues to + * recurse upward. */ } @@ -1414,10 +1416,10 @@ exec_stmt_fors(PLpgSQL_execstate * estate, PLpgSQL_stmt_fors * stmt) SPI_cursor_close(portal); /* - * Set the FOUND variable to indicate the result of executing the - * loop (namely, whether we looped one or more times). This must be - * set here so that it does not interfere with the value of the - * FOUND variable inside the loop processing itself. + * Set the FOUND variable to indicate the result of executing the loop + * (namely, whether we looped one or more times). This must be set + * here so that it does not interfere with the value of the FOUND + * variable inside the loop processing itself. */ exec_set_found(estate, found); @@ -1579,14 +1581,14 @@ exec_stmt_return(PLpgSQL_execstate * estate, PLpgSQL_stmt_return * stmt) /* * Notes: - * - the tuple store must be created in a sufficiently long-lived - * memory context, as the same store must be used within the executor - * after the PL/PgSQL call returns. At present, the code uses - * TopTransactionContext. + * - the tuple store must be created in a sufficiently long-lived + * memory context, as the same store must be used within the executor + * after the PL/PgSQL call returns. At present, the code uses + * TopTransactionContext. */ static int -exec_stmt_return_next(PLpgSQL_execstate *estate, - PLpgSQL_stmt_return_next *stmt) +exec_stmt_return_next(PLpgSQL_execstate * estate, + PLpgSQL_stmt_return_next * stmt) { TupleDesc tupdesc; int natts; @@ -1601,7 +1603,7 @@ exec_stmt_return_next(PLpgSQL_execstate *estate, /* rettupdesc will be filled by exec_init_tuple_store */ tupdesc = estate->rettupdesc; - natts = tupdesc->natts; + natts = tupdesc->natts; if (stmt->rec) { @@ -1613,15 +1615,15 @@ exec_stmt_return_next(PLpgSQL_execstate *estate, } else if (stmt->row) { - Datum *dvalues; - char *nulls; - int i; + Datum *dvalues; + char *nulls; + int i; if (natts != stmt->row->nfields) elog(ERROR, "Wrong record type supplied in RETURN NEXT"); - dvalues = (Datum *) palloc(natts * sizeof(Datum)); - nulls = (char *) palloc(natts * sizeof(char)); + dvalues = (Datum *) palloc(natts * sizeof(Datum)); + nulls = (char *) palloc(natts * sizeof(char)); MemSet(dvalues, 0, natts * sizeof(Datum)); MemSet(nulls, 'n', natts); @@ -1645,10 +1647,10 @@ exec_stmt_return_next(PLpgSQL_execstate *estate, } else if (stmt->expr) { - Datum retval; - bool isNull; - Oid rettype; - char nullflag; + Datum retval; + bool isNull; + Oid rettype; + char nullflag; if (natts != 1) elog(ERROR, "Wrong result type supplied in RETURN NEXT"); @@ -1661,9 +1663,9 @@ exec_stmt_return_next(PLpgSQL_execstate *estate, /* coerce type if needed */ if (!isNull && rettype != tupdesc->attrs[0]->atttypid) { - Oid targType = tupdesc->attrs[0]->atttypid; - Oid typInput; - Oid typElem; + Oid targType = tupdesc->attrs[0]->atttypid; + Oid typInput; + Oid typElem; FmgrInfo finfo_input; getTypeInputInfo(targType, &typInput, &typElem); @@ -1708,7 +1710,7 @@ exec_stmt_return_next(PLpgSQL_execstate *estate, } static void -exec_init_tuple_store(PLpgSQL_execstate *estate) +exec_init_tuple_store(PLpgSQL_execstate * estate) { ReturnSetInfo *rsi = estate->rsi; MemoryContext oldcxt; @@ -1895,8 +1897,8 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt) * ---------- */ static void -plpgsql_estate_setup(PLpgSQL_execstate *estate, - PLpgSQL_function *func, +plpgsql_estate_setup(PLpgSQL_execstate * estate, + PLpgSQL_function * func, ReturnSetInfo *rsi) { estate->retval = (Datum) 0; @@ -2124,6 +2126,7 @@ exec_stmt_execsql(PLpgSQL_execstate * estate, case SPI_OK_INSERT: case SPI_OK_DELETE: case SPI_OK_UPDATE: + /* * If the INSERT, DELETE, or UPDATE query affected at least * one tuple, set the magic 'FOUND' variable to true. This @@ -2228,25 +2231,25 @@ exec_stmt_dynexecute(PLpgSQL_execstate * estate, case SPI_OK_SELINTO: /* - * We want to disallow SELECT INTO for now, because its behavior - * is not consistent with SELECT INTO in a normal plpgsql - * context. (We need to reimplement EXECUTE to parse the string - * as a plpgsql command, not just feed it to SPI_exec.) - * However, CREATE AS should be allowed ... and since it produces - * the same parsetree as SELECT INTO, there's no way to tell - * the difference except to look at the source text. Wotta - * kluge! + * We want to disallow SELECT INTO for now, because its + * behavior is not consistent with SELECT INTO in a normal + * plpgsql context. (We need to reimplement EXECUTE to parse + * the string as a plpgsql command, not just feed it to + * SPI_exec.) However, CREATE AS should be allowed ... and + * since it produces the same parsetree as SELECT INTO, + * there's no way to tell the difference except to look at the + * source text. Wotta kluge! */ - { - char *ptr; + { + char *ptr; - for (ptr = querystr; *ptr; ptr++) - if (!isspace((unsigned char) *ptr)) - break; - if (*ptr == 'S' || *ptr == 's') - elog(ERROR, "EXECUTE of SELECT ... INTO is not implemented yet"); - break; - } + for (ptr = querystr; *ptr; ptr++) + if (!isspace((unsigned char) *ptr)) + break; + if (*ptr == 'S' || *ptr == 's') + elog(ERROR, "EXECUTE of SELECT ... INTO is not implemented yet"); + break; + } default: elog(ERROR, "unexpected error %d in EXECUTE of query '%s'", @@ -2399,9 +2402,10 @@ exec_stmt_dynfors(PLpgSQL_execstate * estate, PLpgSQL_stmt_dynfors * stmt) } /* - * otherwise, we processed a labelled exit that does not - * match the current statement's label, if any: return - * RC_EXIT so that the EXIT continues to recurse upward. + * otherwise, we processed a labelled exit that does + * not match the current statement's label, if any: + * return RC_EXIT so that the EXIT continues to + * recurse upward. */ } @@ -2425,10 +2429,10 @@ exec_stmt_dynfors(PLpgSQL_execstate * estate, PLpgSQL_stmt_dynfors * stmt) SPI_cursor_close(portal); /* - * Set the FOUND variable to indicate the result of executing the - * loop (namely, whether we looped one or more times). This must be - * set here so that it does not interfere with the value of the - * FOUND variable inside the loop processing itself. + * Set the FOUND variable to indicate the result of executing the loop + * (namely, whether we looped one or more times). This must be set + * here so that it does not interfere with the value of the FOUND + * variable inside the loop processing itself. */ exec_set_found(estate, found); diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c index deaa2690e31..7da64447700 100644 --- a/src/pl/plpgsql/src/pl_funcs.c +++ b/src/pl/plpgsql/src/pl_funcs.c @@ -3,7 +3,7 @@ * procedural language * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.21 2002/08/30 00:28:41 tgl Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.22 2002/09/04 20:31:47 momjian Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -88,7 +88,8 @@ plpgsql_dstring_append(PLpgSQL_dstring * ds, char *str) if (needed > ds->alloc) { /* might have to double more than once, if len is large */ - do { + do + { ds->alloc *= 2; } while (needed > ds->alloc); ds->value = repalloc(ds->value, ds->alloc); @@ -324,9 +325,9 @@ plpgsql_ns_rename(char *oldname, char *newname) * truncate to NAMEDATALEN. * * There may be several identifiers separated by dots and optional - * whitespace. Each one is converted to a separate palloc'd string. + * whitespace. Each one is converted to a separate palloc'd string. * The caller passes the expected number of identifiers, as well as - * a char* array to hold them. It is an error if we find the wrong + * a char* array to hold them. It is an error if we find the wrong * number of identifiers (cf grammar processing of fori_varname). * * NOTE: the input string has already been accepted by the flex lexer, @@ -347,7 +348,7 @@ plpgsql_convert_ident(const char *s, char **output, int numidents) int i; /* Process current identifier */ - curident = palloc(strlen(s) + 1); /* surely enough room */ + curident = palloc(strlen(s) + 1); /* surely enough room */ cp = curident; if (*s == '"') @@ -392,9 +393,9 @@ plpgsql_convert_ident(const char *s, char **output, int numidents) if (i >= NAMEDATALEN) { - int len; + int len; - len = pg_mbcliplen(curident, i, NAMEDATALEN-1); + len = pg_mbcliplen(curident, i, NAMEDATALEN - 1); curident[len] = '\0'; } diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h index c81b0a3b1bc..1d5ab78a328 100644 --- a/src/pl/plpgsql/src/plpgsql.h +++ b/src/pl/plpgsql/src/plpgsql.h @@ -3,7 +3,7 @@ * procedural language * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.26 2002/08/30 00:28:41 tgl Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.27 2002/09/04 20:31:47 momjian Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -514,7 +514,7 @@ typedef struct char *exitlabel; Tuplestorestate *tuple_store; /* SRFs accumulate results here */ - MemoryContext tuple_store_cxt; + MemoryContext tuple_store_cxt; ReturnSetInfo *rsi; int trig_nargs; diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c index 986937e5e0a..78b23a1a25c 100644 --- a/src/pl/plpython/plpython.c +++ b/src/pl/plpython/plpython.c @@ -29,7 +29,7 @@ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.20 2002/08/22 00:01:50 tgl Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.21 2002/09/04 20:31:48 momjian Exp $ * ********************************************************************* */ @@ -189,8 +189,8 @@ static void PLy_init_safe_interp(void); static void PLy_init_plpy(void); /* Helper functions used during initialization */ -static int populate_methods(PyObject *klass, PyMethodDef *methods); -static PyObject *build_tuple(char* string_list[], int len); +static int populate_methods(PyObject * klass, PyMethodDef * methods); +static PyObject *build_tuple(char *string_list[], int len); /* error handler. collects the current Python exception, if any, * and appends it to the error and sends it to elog @@ -250,7 +250,7 @@ static void PLy_input_tuple_funcs(PLyTypeInfo *, TupleDesc); /* RExec methods */ -static PyObject *PLy_r_open(PyObject *self, PyObject* args); +static PyObject *PLy_r_open(PyObject * self, PyObject * args); /* conversion functions */ @@ -333,9 +333,9 @@ static char *PLy_ok_sys_names_list[] = { /* Python exceptions */ -static PyObject *PLy_exc_error = NULL; -static PyObject *PLy_exc_fatal = NULL; -static PyObject *PLy_exc_spi_error = NULL; +static PyObject *PLy_exc_error = NULL; +static PyObject *PLy_exc_fatal = NULL; +static PyObject *PLy_exc_spi_error = NULL; /* some globals for the python module */ @@ -408,9 +408,7 @@ plpython_call_handler(PG_FUNCTION_ARGS) else PLy_restart_in_progress += 1; if (proc) - { Py_DECREF(proc->me); - } RERAISE_EXC(); } @@ -1676,6 +1674,7 @@ static PyObject *PLy_plan_status(PyObject *, PyObject *); static PyObject *PLy_result_new(void); static void PLy_result_dealloc(PyObject *); static PyObject *PLy_result_getattr(PyObject *, char *); + #ifdef NOT_USED /* Appear to be unused */ static PyObject *PLy_result_fetch(PyObject *, PyObject *); @@ -1770,6 +1769,7 @@ static PyTypeObject PLy_ResultType = { 0, /* tp_xxx4 */ PLy_result_doc, /* tp_doc */ }; + #ifdef NOT_USED /* Appear to be unused */ static PyMethodDef PLy_result_methods[] = { @@ -1923,6 +1923,7 @@ PLy_result_getattr(PyObject * self, char *attr) { return NULL; } + #ifdef NOT_USED /* Appear to be unused */ PyObject * @@ -2043,7 +2044,7 @@ PLy_spi_prepare(PyObject * self, PyObject * args) if (!PyErr_Occurred()) PyErr_SetString(PLy_exc_spi_error, "Unknown error in PLy_spi_prepare."); - PLy_elog(WARNING,"in function %s:",PLy_procedure_name(PLy_last_procedure)); + PLy_elog(WARNING, "in function %s:", PLy_procedure_name(PLy_last_procedure)); RERAISE_EXC(); } @@ -2232,7 +2233,7 @@ PLy_spi_execute_plan(PyObject * ob, PyObject * list, int limit) if (!PyErr_Occurred()) PyErr_SetString(PLy_exc_error, "Unknown error in PLy_spi_execute_plan"); - PLy_elog(WARNING,"in function %s:",PLy_procedure_name(PLy_last_procedure)); + PLy_elog(WARNING, "in function %s:", PLy_procedure_name(PLy_last_procedure)); RERAISE_EXC(); } @@ -2298,7 +2299,7 @@ PLy_spi_execute_query(char *query, int limit) if ((!PLy_restart_in_progress) && (!PyErr_Occurred())) PyErr_SetString(PLy_exc_spi_error, "Unknown error in PLy_spi_execute_query."); - PLy_elog(WARNING,"in function %s:",PLy_procedure_name(PLy_last_procedure)); + PLy_elog(WARNING, "in function %s:", PLy_procedure_name(PLy_last_procedure)); RERAISE_EXC(); } @@ -2496,11 +2497,11 @@ PLy_init_plpy(void) } /* - * New RExec methods + * New RExec methods */ -PyObject* -PLy_r_open(PyObject *self, PyObject* args) +PyObject * +PLy_r_open(PyObject * self, PyObject * args) { PyErr_SetString(PyExc_IOError, "can't open files in restricted mode"); return NULL; @@ -2508,20 +2509,22 @@ PLy_r_open(PyObject *self, PyObject* args) static PyMethodDef PLy_r_exec_methods[] = { - {"r_open", (PyCFunction)PLy_r_open, METH_VARARGS, NULL}, + {"r_open", (PyCFunction) PLy_r_open, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }; /* - * Init new RExec + * Init new RExec */ void PLy_init_safe_interp(void) { - PyObject *rmod, *rexec, *rexec_dict; + PyObject *rmod, + *rexec, + *rexec_dict; char *rname = "rexec"; - int len; + int len; enter(); @@ -2554,31 +2557,33 @@ PLy_init_safe_interp(void) PLy_elog(ERROR, "Unable to get RExec object."); - rexec_dict = ((PyClassObject*)rexec)->cl_dict; + rexec_dict = ((PyClassObject *) rexec)->cl_dict; /* * tweak the list of permitted modules, posix and sys functions */ PyDict_SetItemString(rexec_dict, "ok_builtin_modules", PLy_importable_modules); - PyDict_SetItemString(rexec_dict, "ok_posix_names", PLy_ok_posix_names); - PyDict_SetItemString(rexec_dict, "ok_sys_names", PLy_ok_sys_names); + PyDict_SetItemString(rexec_dict, "ok_posix_names", PLy_ok_posix_names); + PyDict_SetItemString(rexec_dict, "ok_sys_names", PLy_ok_sys_names); /* * change the r_open behavior */ - if( populate_methods(rexec, PLy_r_exec_methods) ) + if (populate_methods(rexec, PLy_r_exec_methods)) PLy_elog(ERROR, "Failed to update RExec methods."); } /* Helper function to build tuples from string lists */ static -PyObject *build_tuple(char* string_list[], int len) +PyObject * +build_tuple(char *string_list[], int len) { - PyObject *tup = PyTuple_New(len); - int i; + PyObject *tup = PyTuple_New(len); + int i; + for (i = 0; i < len; i++) { - PyObject *m = PyString_FromString(string_list[i]); + PyObject *m = PyString_FromString(string_list[i]); PyTuple_SetItem(tup, i, m); } @@ -2587,30 +2592,32 @@ PyObject *build_tuple(char* string_list[], int len) /* Helper function for populating a class with method wrappers. */ static int -populate_methods(PyObject *klass, PyMethodDef *methods) +populate_methods(PyObject * klass, PyMethodDef * methods) { if (!klass || !methods) return 0; - for ( ; methods->ml_name; ++methods) { + for (; methods->ml_name; ++methods) + { /* get a wrapper for the built-in function */ - PyObject *func = PyCFunction_New(methods, NULL); - PyObject *meth; - int status; + PyObject *func = PyCFunction_New(methods, NULL); + PyObject *meth; + int status; if (!func) return -1; /* turn the function into an unbound method */ - if (!(meth = PyMethod_New(func, NULL, klass))) { + if (!(meth = PyMethod_New(func, NULL, klass))) + { Py_DECREF(func); return -1; } /* add method to dictionary */ - status = PyDict_SetItemString( ((PyClassObject*)klass)->cl_dict, - methods->ml_name, meth); + status = PyDict_SetItemString(((PyClassObject *) klass)->cl_dict, + methods->ml_name, meth); Py_DECREF(meth); Py_DECREF(func); @@ -2746,11 +2753,12 @@ PLy_output(volatile int level, PyObject * self, PyObject * args) * another plpython procedure ) */ -char *PLy_procedure_name(PLyProcedure *proc) +char * +PLy_procedure_name(PLyProcedure * proc) { - if ( proc == NULL ) - return "<unknown procedure>"; - return proc->proname; + if (proc == NULL) + return "<unknown procedure>"; + return proc->proname; } /* output a python traceback/exception via the postgresql elog diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c index 477dd52d1fd..44ee940e785 100644 --- a/src/pl/tcl/pltcl.c +++ b/src/pl/tcl/pltcl.c @@ -31,7 +31,7 @@ * ENHANCEMENTS, OR MODIFICATIONS. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.60 2002/08/22 00:01:50 tgl Exp $ + * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.61 2002/09/04 20:31:48 momjian Exp $ * **********************************************************************/ @@ -976,7 +976,7 @@ compile_pltcl_function(Oid fn_oid, bool is_trigger) prodesc = (pltcl_proc_desc *) Tcl_GetHashValue(hashent); uptodate = (prodesc->fn_xmin == HeapTupleHeaderGetXmin(procTup->t_data) && - prodesc->fn_cmin == HeapTupleHeaderGetCmin(procTup->t_data)); + prodesc->fn_cmin == HeapTupleHeaderGetCmin(procTup->t_data)); if (!uptodate) { @@ -1060,7 +1060,7 @@ compile_pltcl_function(Oid fn_oid, bool is_trigger) if (typeStruct->typtype == 'p') { if (procStruct->prorettype == VOIDOID) - /* okay */; + /* okay */ ; else if (procStruct->prorettype == TRIGGEROID || procStruct->prorettype == OPAQUEOID) { |
