diff options
| author | Bruce Momjian | 2012-06-10 19:20:04 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2012-06-10 19:20:04 +0000 |
| commit | 927d61eeff78363ea3938c818d07e511ebaf75cf (patch) | |
| tree | 2f0bcecf53327f76272a8ce690fa62505520fab9 /src/pl/plpython | |
| parent | 60801944fa105252b48ea5688d47dfc05c695042 (diff) | |
Run pgindent on 9.2 source tree in preparation for first 9.3
commit-fest.
Diffstat (limited to 'src/pl/plpython')
| -rw-r--r-- | src/pl/plpython/plpy_cursorobject.c | 31 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_cursorobject.h | 4 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_elog.c | 16 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_elog.h | 13 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_exec.c | 6 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_exec.h | 2 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_main.c | 13 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_main.h | 6 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_planobject.h | 2 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_plpymodule.c | 5 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_plpymodule.h | 2 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_procedure.h | 2 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_resultobject.c | 6 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_resultobject.h | 5 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_spi.c | 40 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_spi.h | 2 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_subxactobject.c | 2 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_subxactobject.h | 2 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_typeio.c | 6 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_typeio.h | 2 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_util.c | 1 | ||||
| -rw-r--r-- | src/pl/plpython/plpy_util.h | 2 | ||||
| -rw-r--r-- | src/pl/plpython/plpython.h | 8 |
23 files changed, 93 insertions, 85 deletions
diff --git a/src/pl/plpython/plpy_cursorobject.c b/src/pl/plpython/plpy_cursorobject.c index e8240b63c90..910e63b1995 100644 --- a/src/pl/plpython/plpy_cursorobject.c +++ b/src/pl/plpython/plpy_cursorobject.c @@ -40,7 +40,7 @@ static PyMethodDef PLy_cursor_methods[] = { static PyTypeObject PLy_CursorType = { PyVarObject_HEAD_INIT(NULL, 0) - "PLyCursor", /* tp_name */ + "PLyCursor", /* tp_name */ sizeof(PLyCursorObject), /* tp_size */ 0, /* tp_itemsize */ @@ -103,7 +103,7 @@ PLy_cursor(PyObject *self, PyObject *args) static PyObject * PLy_cursor_query(const char *query) { - PLyCursorObject *cursor; + PLyCursorObject *cursor; volatile MemoryContext oldcontext; volatile ResourceOwner oldowner; @@ -120,7 +120,7 @@ PLy_cursor_query(const char *query) PG_TRY(); { - PLyExecutionContext *exec_ctx = PLy_current_execution_context(); + PLyExecutionContext *exec_ctx = PLy_current_execution_context(); SPIPlanPtr plan; Portal portal; @@ -157,7 +157,7 @@ PLy_cursor_query(const char *query) static PyObject * PLy_cursor_plan(PyObject *ob, PyObject *args) { - PLyCursorObject *cursor; + PLyCursorObject *cursor; volatile int nargs; int i; PLyPlanObject *plan; @@ -187,8 +187,8 @@ PLy_cursor_plan(PyObject *ob, PyObject *args) PLy_elog(ERROR, "could not execute plan"); sv = PyString_AsString(so); PLy_exception_set_plural(PyExc_TypeError, - "Expected sequence of %d argument, got %d: %s", - "Expected sequence of %d arguments, got %d: %s", + "Expected sequence of %d argument, got %d: %s", + "Expected sequence of %d arguments, got %d: %s", plan->nargs, plan->nargs, nargs, sv); Py_DECREF(so); @@ -305,7 +305,7 @@ static void PLy_cursor_dealloc(PyObject *arg) { PLyCursorObject *cursor; - Portal portal; + Portal portal; cursor = (PLyCursorObject *) arg; @@ -328,10 +328,10 @@ static PyObject * PLy_cursor_iternext(PyObject *self) { PLyCursorObject *cursor; - PyObject *ret; + PyObject *ret; volatile MemoryContext oldcontext; volatile ResourceOwner oldowner; - Portal portal; + Portal portal; cursor = (PLyCursorObject *) self; @@ -391,11 +391,11 @@ static PyObject * PLy_cursor_fetch(PyObject *self, PyObject *args) { PLyCursorObject *cursor; - int count; - PLyResultObject *ret; + int count; + PLyResultObject *ret; volatile MemoryContext oldcontext; volatile ResourceOwner oldowner; - Portal portal; + Portal portal; if (!PyArg_ParseTuple(args, "i", &count)) return NULL; @@ -440,7 +440,7 @@ PLy_cursor_fetch(PyObject *self, PyObject *args) if (SPI_processed != 0) { - int i; + int i; Py_DECREF(ret->rows); ret->rows = PyList_New(SPI_processed); @@ -450,6 +450,7 @@ PLy_cursor_fetch(PyObject *self, PyObject *args) PyObject *row = PLyDict_FromTuple(&cursor->result, SPI_tuptable->vals[i], SPI_tuptable->tupdesc); + PyList_SetItem(ret->rows, i, row); } } @@ -477,12 +478,12 @@ PLy_cursor_close(PyObject *self, PyObject *unused) if (!cursor->closed) { - Portal portal = GetPortalByName(cursor->portalname); + Portal portal = GetPortalByName(cursor->portalname); if (!PortalIsValid(portal)) { PLy_exception_set(PyExc_ValueError, - "closing a cursor in an aborted subtransaction"); + "closing a cursor in an aborted subtransaction"); return NULL; } diff --git a/src/pl/plpython/plpy_cursorobject.h b/src/pl/plpython/plpy_cursorobject.h index 1dd9d48fd58..3c28f4f8e71 100644 --- a/src/pl/plpython/plpy_cursorobject.h +++ b/src/pl/plpython/plpy_cursorobject.h @@ -11,7 +11,7 @@ typedef struct PLyCursorObject { PyObject_HEAD - char *portalname; + char *portalname; PLyTypeInfo result; bool closed; } PLyCursorObject; @@ -19,4 +19,4 @@ typedef struct PLyCursorObject extern void PLy_cursor_init_type(void); extern PyObject *PLy_cursor(PyObject *self, PyObject *args); -#endif /* PLPY_CURSOROBJECT_H */ +#endif /* PLPY_CURSOROBJECT_H */ diff --git a/src/pl/plpython/plpy_elog.c b/src/pl/plpython/plpy_elog.c index f7d321289d4..c375ac07fa8 100644 --- a/src/pl/plpython/plpy_elog.c +++ b/src/pl/plpython/plpy_elog.c @@ -16,15 +16,15 @@ #include "plpy_procedure.h" -PyObject *PLy_exc_error = NULL; -PyObject *PLy_exc_fatal = NULL; -PyObject *PLy_exc_spi_error = NULL; +PyObject *PLy_exc_error = NULL; +PyObject *PLy_exc_fatal = NULL; +PyObject *PLy_exc_spi_error = NULL; static void PLy_traceback(char **xmsg, char **tbmsg, int *tb_depth); static void PLy_get_spi_error_data(PyObject *exc, int *sqlerrcode, char **detail, - char **hint, char **query, int *position); -static char * get_source_line(const char *src, int lineno); + char **hint, char **query, int *position); +static char *get_source_line(const char *src, int lineno); /* @@ -46,7 +46,7 @@ PLy_elog(int elevel, const char *fmt,...) *val, *tb; const char *primary = NULL; - int sqlerrcode = 0; + int sqlerrcode = 0; char *detail = NULL; char *hint = NULL; char *query = NULL; @@ -98,7 +98,7 @@ PLy_elog(int elevel, const char *fmt,...) { ereport(elevel, (errcode(sqlerrcode ? sqlerrcode : ERRCODE_INTERNAL_ERROR), - errmsg_internal("%s", primary ? primary : "no exception data"), + errmsg_internal("%s", primary ? primary : "no exception data"), (detail) ? errdetail_internal("%s", detail) : 0, (tb_depth > 0 && tbmsg) ? errcontext("%s", tbmsg) : 0, (hint) ? errhint("%s", hint) : 0, @@ -256,7 +256,7 @@ PLy_traceback(char **xmsg, char **tbmsg, int *tb_depth) /* The first frame always points at <module>, skip it. */ if (*tb_depth > 0) { - PLyExecutionContext *exec_ctx = PLy_current_execution_context(); + PLyExecutionContext *exec_ctx = PLy_current_execution_context(); char *proname; char *fname; char *line; diff --git a/src/pl/plpython/plpy_elog.h b/src/pl/plpython/plpy_elog.h index f7223b00568..6b8d485625b 100644 --- a/src/pl/plpython/plpy_elog.h +++ b/src/pl/plpython/plpy_elog.h @@ -10,15 +10,18 @@ extern PyObject *PLy_exc_error; extern PyObject *PLy_exc_fatal; extern PyObject *PLy_exc_spi_error; -extern void PLy_elog(int elevel, const char *fmt,...) +extern void +PLy_elog(int elevel, const char *fmt,...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3))); -extern void PLy_exception_set(PyObject *exc, const char *fmt,...) +extern void +PLy_exception_set(PyObject *exc, const char *fmt,...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3))); -extern void PLy_exception_set_plural(PyObject *exc, const char *fmt_singular, const char *fmt_plural, - unsigned long n,...) +extern void +PLy_exception_set_plural(PyObject *exc, const char *fmt_singular, const char *fmt_plural, + unsigned long n,...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 5))) __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 5))); -#endif /* PLPY_ELOG_H */ +#endif /* PLPY_ELOG_H */ diff --git a/src/pl/plpython/plpy_exec.c b/src/pl/plpython/plpy_exec.c index ad30fc0065b..96ee26c35c7 100644 --- a/src/pl/plpython/plpy_exec.c +++ b/src/pl/plpython/plpy_exec.c @@ -30,9 +30,9 @@ static void PLy_function_delete_args(PLyProcedure *proc); static void plpython_return_error_callback(void *arg); static PyObject *PLy_trigger_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc, - HeapTuple *rv); + HeapTuple *rv); static HeapTuple PLy_modify_tuple(PLyProcedure *proc, PyObject *pltd, - TriggerData *tdata, HeapTuple otup); + TriggerData *tdata, HeapTuple otup); static void plpython_trigger_error_callback(void *arg); static PyObject *PLy_procedure_call(PLyProcedure *proc, char *kargs, PyObject *vargs); @@ -180,7 +180,7 @@ PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc) } else if (proc->result.is_rowtype >= 1) { - TupleDesc desc; + TupleDesc desc; /* make sure it's not an unnamed record */ Assert((proc->result.out.d.typoid == RECORDOID && diff --git a/src/pl/plpython/plpy_exec.h b/src/pl/plpython/plpy_exec.h index f3dec074c13..439a1d801f6 100644 --- a/src/pl/plpython/plpy_exec.h +++ b/src/pl/plpython/plpy_exec.h @@ -10,4 +10,4 @@ extern Datum PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc); extern HeapTuple PLy_exec_trigger(FunctionCallInfo fcinfo, PLyProcedure *proc); -#endif /* PLPY_EXEC_H */ +#endif /* PLPY_EXEC_H */ diff --git a/src/pl/plpython/plpy_main.c b/src/pl/plpython/plpy_main.c index c126db995ae..494ec37ea7c 100644 --- a/src/pl/plpython/plpy_main.c +++ b/src/pl/plpython/plpy_main.c @@ -73,7 +73,7 @@ static void PLy_pop_execution_context(void); static const int plpython_python_version = PY_MAJOR_VERSION; /* initialize global variables */ -PyObject *PLy_interp_globals = NULL; +PyObject *PLy_interp_globals = NULL; /* this doesn't need to be global; use PLy_current_execution_context() */ static PLyExecutionContext *PLy_execution_contexts = NULL; @@ -284,8 +284,8 @@ plpython_inline_handler(PG_FUNCTION_ARGS) * Push execution context onto stack. It is important that this get * popped again, so avoid putting anything that could throw error between * here and the PG_TRY. (plpython_inline_error_callback doesn't currently - * need the stack entry, but for consistency with plpython_call_handler - * we do it in this order.) + * need the stack entry, but for consistency with plpython_call_handler we + * do it in this order.) */ exec_ctx = PLy_push_execution_context(); @@ -330,7 +330,8 @@ plpython2_inline_handler(PG_FUNCTION_ARGS) } #endif /* PY_MAJOR_VERSION < 3 */ -static bool PLy_procedure_is_trigger(Form_pg_proc procStruct) +static bool +PLy_procedure_is_trigger(Form_pg_proc procStruct) { return (procStruct->prorettype == TRIGGEROID || (procStruct->prorettype == OPAQUEOID && @@ -365,7 +366,7 @@ PLy_current_execution_context(void) static PLyExecutionContext * PLy_push_execution_context(void) { - PLyExecutionContext *context = PLy_malloc(sizeof(PLyExecutionContext)); + PLyExecutionContext *context = PLy_malloc(sizeof(PLyExecutionContext)); context->curr_proc = NULL; context->scratch_ctx = AllocSetContextCreate(TopTransactionContext, @@ -381,7 +382,7 @@ PLy_push_execution_context(void) static void PLy_pop_execution_context(void) { - PLyExecutionContext *context = PLy_execution_contexts; + PLyExecutionContext *context = PLy_execution_contexts; if (context == NULL) elog(ERROR, "no Python function is currently executing"); diff --git a/src/pl/plpython/plpy_main.h b/src/pl/plpython/plpy_main.h index cb214bf83c7..b13e2c21a11 100644 --- a/src/pl/plpython/plpy_main.h +++ b/src/pl/plpython/plpy_main.h @@ -17,12 +17,12 @@ extern PyObject *PLy_interp_globals; */ typedef struct PLyExecutionContext { - PLyProcedure *curr_proc; /* the currently executing procedure */ - MemoryContext scratch_ctx; /* a context for things like type I/O */ + PLyProcedure *curr_proc; /* the currently executing procedure */ + MemoryContext scratch_ctx; /* a context for things like type I/O */ struct PLyExecutionContext *next; /* previous stack level */ } PLyExecutionContext; /* Get the current execution context */ extern PLyExecutionContext *PLy_current_execution_context(void); -#endif /* PLPY_MAIN_H */ +#endif /* PLPY_MAIN_H */ diff --git a/src/pl/plpython/plpy_planobject.h b/src/pl/plpython/plpy_planobject.h index febc5c25ef6..7a89ffc2c18 100644 --- a/src/pl/plpython/plpy_planobject.h +++ b/src/pl/plpython/plpy_planobject.h @@ -23,4 +23,4 @@ extern void PLy_plan_init_type(void); extern PyObject *PLy_plan_new(void); extern bool is_PLyPlanObject(PyObject *ob); -#endif /* PLPY_PLANOBJECT_H */ +#endif /* PLPY_PLANOBJECT_H */ diff --git a/src/pl/plpython/plpy_plpymodule.c b/src/pl/plpython/plpy_plpymodule.c index bc0b9e6f842..37ea2a490d9 100644 --- a/src/pl/plpython/plpy_plpymodule.c +++ b/src/pl/plpython/plpy_plpymodule.c @@ -21,7 +21,7 @@ #include "plpy_subxactobject.h" -HTAB *PLy_spi_exceptions = NULL; +HTAB *PLy_spi_exceptions = NULL; static void PLy_add_exceptions(PyObject *plpy); @@ -137,7 +137,7 @@ PyInit_plpy(void) return m; } -#endif /* PY_MAJOR_VERSION >= 3 */ +#endif /* PY_MAJOR_VERSION >= 3 */ void PLy_init_plpy(void) @@ -145,6 +145,7 @@ PLy_init_plpy(void) PyObject *main_mod, *main_dict, *plpy_mod; + #if PY_MAJOR_VERSION < 3 PyObject *plpy; #endif diff --git a/src/pl/plpython/plpy_plpymodule.h b/src/pl/plpython/plpy_plpymodule.h index 930ecfd1b17..ee089b78a16 100644 --- a/src/pl/plpython/plpy_plpymodule.h +++ b/src/pl/plpython/plpy_plpymodule.h @@ -16,4 +16,4 @@ PyMODINIT_FUNC PyInit_plpy(void); #endif extern void PLy_init_plpy(void); -#endif /* PLPY_PLPYMODULE_H */ +#endif /* PLPY_PLPYMODULE_H */ diff --git a/src/pl/plpython/plpy_procedure.h b/src/pl/plpython/plpy_procedure.h index c7405e064ec..40a0314cdfb 100644 --- a/src/pl/plpython/plpy_procedure.h +++ b/src/pl/plpython/plpy_procedure.h @@ -45,4 +45,4 @@ extern PLyProcedure *PLy_procedure_get(Oid fn_oid, bool is_trigger); extern void PLy_procedure_compile(PLyProcedure *proc, const char *src); extern void PLy_procedure_delete(PLyProcedure *proc); -#endif /* PLPY_PROCEDURE_H */ +#endif /* PLPY_PROCEDURE_H */ diff --git a/src/pl/plpython/plpy_resultobject.c b/src/pl/plpython/plpy_resultobject.c index deaddb7980f..6b01e717c47 100644 --- a/src/pl/plpython/plpy_resultobject.c +++ b/src/pl/plpython/plpy_resultobject.c @@ -24,7 +24,7 @@ static PyObject *PLy_result_slice(PyObject *arg, Py_ssize_t lidx, Py_ssize_t hid static int PLy_result_ass_item(PyObject *arg, Py_ssize_t idx, PyObject *item); static int PLy_result_ass_slice(PyObject *rg, Py_ssize_t lidx, Py_ssize_t hidx, PyObject *slice); static PyObject *PLy_result_subscript(PyObject *arg, PyObject *item); -static int PLy_result_ass_subscript(PyObject* self, PyObject* item, PyObject* value); +static int PLy_result_ass_subscript(PyObject *self, PyObject *item, PyObject *value); static char PLy_result_doc[] = { "Results of a PostgreSQL query" @@ -263,7 +263,7 @@ PLy_result_ass_slice(PyObject *arg, Py_ssize_t lidx, Py_ssize_t hidx, PyObject * static PyObject * PLy_result_subscript(PyObject *arg, PyObject *item) { - PLyResultObject *ob = (PLyResultObject *) arg; + PLyResultObject *ob = (PLyResultObject *) arg; return PyObject_GetItem(ob->rows, item); } @@ -271,7 +271,7 @@ PLy_result_subscript(PyObject *arg, PyObject *item) static int PLy_result_ass_subscript(PyObject *arg, PyObject *item, PyObject *value) { - PLyResultObject *ob = (PLyResultObject *) arg; + PLyResultObject *ob = (PLyResultObject *) arg; return PyObject_SetItem(ob->rows, item, value); } diff --git a/src/pl/plpython/plpy_resultobject.h b/src/pl/plpython/plpy_resultobject.h index c5ba9998874..314510c40ff 100644 --- a/src/pl/plpython/plpy_resultobject.h +++ b/src/pl/plpython/plpy_resultobject.h @@ -13,7 +13,8 @@ typedef struct PLyResultObject PyObject_HEAD /* HeapTuple *tuples; */ PyObject *nrows; /* number of rows returned by query */ - PyObject *rows; /* data rows, or empty list if no data returned */ + PyObject *rows; /* data rows, or empty list if no data + * returned */ PyObject *status; /* query status, SPI_OK_*, or SPI_ERR_* */ TupleDesc tupdesc; } PLyResultObject; @@ -21,4 +22,4 @@ typedef struct PLyResultObject extern void PLy_result_init_type(void); extern PyObject *PLy_result_new(void); -#endif /* PLPY_RESULTOBJECT_H */ +#endif /* PLPY_RESULTOBJECT_H */ diff --git a/src/pl/plpython/plpy_spi.c b/src/pl/plpython/plpy_spi.c index 4bc3d96d589..00156e6658e 100644 --- a/src/pl/plpython/plpy_spi.c +++ b/src/pl/plpython/plpy_spi.c @@ -350,7 +350,7 @@ PLy_spi_execute_query(char *query, long limit) PG_TRY(); { - PLyExecutionContext *exec_ctx = PLy_current_execution_context(); + PLyExecutionContext *exec_ctx = PLy_current_execution_context(); pg_verifymbstr(query, strlen(query), false); rv = SPI_execute(query, exec_ctx->curr_proc->fn_readonly, limit); @@ -456,22 +456,22 @@ PLy_spi_execute_fetch_result(SPITupleTable *tuptable, int rows, int status) * * Usage: * - * MemoryContext oldcontext = CurrentMemoryContext; - * ResourceOwner oldowner = CurrentResourceOwner; + * MemoryContext oldcontext = CurrentMemoryContext; + * ResourceOwner oldowner = CurrentResourceOwner; * - * PLy_spi_subtransaction_begin(oldcontext, oldowner); - * PG_TRY(); - * { - * <call SPI functions> - * PLy_spi_subtransaction_commit(oldcontext, oldowner); - * } - * PG_CATCH(); - * { - * <do cleanup> - * PLy_spi_subtransaction_abort(oldcontext, oldowner); - * return NULL; - * } - * PG_END_TRY(); + * PLy_spi_subtransaction_begin(oldcontext, oldowner); + * PG_TRY(); + * { + * <call SPI functions> + * PLy_spi_subtransaction_commit(oldcontext, oldowner); + * } + * PG_CATCH(); + * { + * <do cleanup> + * PLy_spi_subtransaction_abort(oldcontext, oldowner); + * return NULL; + * } + * PG_END_TRY(); * * These utilities take care of restoring connection to the SPI manager and * setting a Python exception in case of an abort. @@ -493,8 +493,8 @@ PLy_spi_subtransaction_commit(MemoryContext oldcontext, ResourceOwner oldowner) CurrentResourceOwner = oldowner; /* - * AtEOSubXact_SPI() should not have popped any SPI context, but just - * in case it did, make sure we remain connected. + * AtEOSubXact_SPI() should not have popped any SPI context, but just in + * case it did, make sure we remain connected. */ SPI_restore_connection(); } @@ -517,8 +517,8 @@ PLy_spi_subtransaction_abort(MemoryContext oldcontext, ResourceOwner oldowner) CurrentResourceOwner = oldowner; /* - * If AtEOSubXact_SPI() popped any SPI context of the subxact, it will have - * left us in a disconnected state. We need this hack to return to + * If AtEOSubXact_SPI() popped any SPI context of the subxact, it will + * have left us in a disconnected state. We need this hack to return to * connected state. */ SPI_restore_connection(); diff --git a/src/pl/plpython/plpy_spi.h b/src/pl/plpython/plpy_spi.h index f8d31638ec8..b0427947ef4 100644 --- a/src/pl/plpython/plpy_spi.h +++ b/src/pl/plpython/plpy_spi.h @@ -22,4 +22,4 @@ extern void PLy_spi_subtransaction_begin(MemoryContext oldcontext, ResourceOwner extern void PLy_spi_subtransaction_commit(MemoryContext oldcontext, ResourceOwner oldowner); extern void PLy_spi_subtransaction_abort(MemoryContext oldcontext, ResourceOwner oldowner); -#endif /* PLPY_SPI_H */ +#endif /* PLPY_SPI_H */ diff --git a/src/pl/plpython/plpy_subxactobject.c b/src/pl/plpython/plpy_subxactobject.c index 9feeddb7231..2e7ec4fdab4 100644 --- a/src/pl/plpython/plpy_subxactobject.c +++ b/src/pl/plpython/plpy_subxactobject.c @@ -16,7 +16,7 @@ #include "plpy_elog.h" -List *explicit_subtransactions = NIL; +List *explicit_subtransactions = NIL; static void PLy_subtransaction_dealloc(PyObject *subxact); diff --git a/src/pl/plpython/plpy_subxactobject.h b/src/pl/plpython/plpy_subxactobject.h index 7e3002fc2fd..b8591c7bf07 100644 --- a/src/pl/plpython/plpy_subxactobject.h +++ b/src/pl/plpython/plpy_subxactobject.h @@ -26,4 +26,4 @@ typedef struct PLySubtransactionData extern void PLy_subtransaction_init_type(void); extern PyObject *PLy_subtransaction_new(PyObject *self, PyObject *unused); -#endif /* PLPY_SUBXACTOBJECT */ +#endif /* PLPY_SUBXACTOBJECT */ diff --git a/src/pl/plpython/plpy_typeio.c b/src/pl/plpython/plpy_typeio.c index c5f6c4e5a3e..2cc7bbbd4de 100644 --- a/src/pl/plpython/plpy_typeio.c +++ b/src/pl/plpython/plpy_typeio.c @@ -293,8 +293,8 @@ PLyDict_FromTuple(PLyTypeInfo *info, HeapTuple tuple, TupleDesc desc) PG_TRY(); { /* - * Do the work in the scratch context to avoid leaking memory from - * the datatype output function calls. + * Do the work in the scratch context to avoid leaking memory from the + * datatype output function calls. */ MemoryContextSwitchTo(exec_ctx->scratch_ctx); for (i = 0; i < info->in.r.natts; i++) @@ -341,7 +341,7 @@ PLyDict_FromTuple(PLyTypeInfo *info, HeapTuple tuple, TupleDesc desc) Datum PLyObject_ToCompositeDatum(PLyTypeInfo *info, TupleDesc desc, PyObject *plrv) { - Datum datum; + Datum datum; if (PyString_Check(plrv) || PyUnicode_Check(plrv)) datum = PLyString_ToComposite(info, desc, plrv); diff --git a/src/pl/plpython/plpy_typeio.h b/src/pl/plpython/plpy_typeio.h index 11532b8c201..d2dfa66e0b2 100644 --- a/src/pl/plpython/plpy_typeio.h +++ b/src/pl/plpython/plpy_typeio.h @@ -104,4 +104,4 @@ extern Datum PLyObject_ToCompositeDatum(PLyTypeInfo *info, TupleDesc desc, PyObj /* conversion from heap tuples to Python dictionaries */ extern PyObject *PLyDict_FromTuple(PLyTypeInfo *info, HeapTuple tuple, TupleDesc desc); -#endif /* PLPY_TYPEIO_H */ +#endif /* PLPY_TYPEIO_H */ diff --git a/src/pl/plpython/plpy_util.c b/src/pl/plpython/plpy_util.c index 414b9d5445a..9a4901ecb2f 100644 --- a/src/pl/plpython/plpy_util.c +++ b/src/pl/plpython/plpy_util.c @@ -122,4 +122,5 @@ PLyUnicode_FromString(const char *s) return o; } + #endif /* PY_MAJOR_VERSION >= 3 */ diff --git a/src/pl/plpython/plpy_util.h b/src/pl/plpython/plpy_util.h index 9b9eca0050c..f93e8379fb2 100644 --- a/src/pl/plpython/plpy_util.h +++ b/src/pl/plpython/plpy_util.h @@ -18,4 +18,4 @@ extern char *PLyUnicode_AsString(PyObject *unicode); extern PyObject *PLyUnicode_FromString(const char *s); #endif -#endif /* PLPY_UTIL_H */ +#endif /* PLPY_UTIL_H */ diff --git a/src/pl/plpython/plpython.h b/src/pl/plpython/plpython.h index 15ec85e8057..e788cd9a897 100644 --- a/src/pl/plpython/plpython.h +++ b/src/pl/plpython/plpython.h @@ -132,11 +132,11 @@ typedef int Py_ssize_t; #undef vsnprintf #endif #ifdef __GNUC__ -#define vsnprintf(...) pg_vsnprintf(__VA_ARGS__) -#define snprintf(...) pg_snprintf(__VA_ARGS__) +#define vsnprintf(...) pg_vsnprintf(__VA_ARGS__) +#define snprintf(...) pg_snprintf(__VA_ARGS__) #else -#define vsnprintf pg_vsnprintf -#define snprintf pg_snprintf +#define vsnprintf pg_vsnprintf +#define snprintf pg_snprintf #endif /* __GNUC__ */ #endif /* USE_REPL_SNPRINTF */ |
