8000 PL/Python: Add argument names to function declarations · postgrespro/postgres@f9de1e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit f9de1e9

Browse files
committed
PL/Python: Add argument names to function declarations
For easier source reading
1 parent a671d94 commit f9de1e9

20 files changed

+106
-106
lines changed

src/pl/plpython/plpy_cursorobject.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
#include "plpy_spi.h"
2121

2222

23-
static PyObject *PLy_cursor_query(const char *);
24-
static PyObject *PLy_cursor_plan(PyObject *, PyObject *);
25-
static void PLy_cursor_dealloc(PyObject *);
26-
static PyObject *PLy_cursor_iternext(PyObject *);
27-
static PyObject *PLy_cursor_fetch(PyObject *, PyObject *);
28-
static PyObject *PLy_cursor_close(PyObject *, PyObject *);
23+
static PyObject *PLy_cursor_query(const char *query);
24+
static PyObject *PLy_cursor_plan(PyObject *ob, PyObject *args);
25+
static void PLy_cursor_dealloc(PyObject *arg);
26+
static PyObject *PLy_cursor_iternext(PyObject *self);
27+
static PyObject *PLy_cursor_fetch(PyObject *self, PyObject *args);
28+
static PyObject *PLy_cursor_close(PyObject *self, PyObject *unused);
2929

3030
static char PLy_cursor_doc[] = {
3131
"Wrapper around a PostgreSQL cursor"

src/pl/plpython/plpy_cursorobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ typedef struct PLyCursorObject
1717
} PLyCursorObject;
1818

1919
extern void PLy_cursor_init_type(void);
20-
extern PyObject *PLy_cursor(PyObject *, PyObject *);
20+
extern PyObject *PLy_cursor(PyObject *self, PyObject *args);
2121

2222
#endif /* PLPY_CURSOROBJECT_H */

src/pl/plpython/plpy_elog.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ PyObject *PLy_exc_fatal = NULL;
2020
PyObject *PLy_exc_spi_error = NULL;
2121

2222

23-
static void PLy_traceback(char **, char **, int *);
24-
static void PLy_get_spi_error_data(PyObject *, int *, char **,
25-
char **, char **, int *);
26-
static char * get_source_line(const char *, int);
23+
static void PLy_traceback(char **xmsg, char **tbmsg, int *tb_depth);
24+
static void PLy_get_spi_error_data(PyObject *exc, int *sqlerrcode, char **detail,
25+
char **hint, char **query, int *position);
26+
static char * get_source_line(const char *src, int lineno);
2727

2828

2929
/*

src/pl/plpython/plpy_elog.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ extern PyObject *PLy_exc_error;
1010
extern PyObject *PLy_exc_fatal;
1111
extern PyObject *PLy_exc_spi_error;
1212

13-
extern void PLy_elog(int, const char *,...)
13+
extern void PLy_elog(int elevel, const char *fmt,...)
1414
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
1515

16-
extern void PLy_exception_set(PyObject *, const char *,...)
16+
extern void PLy_exception_set(PyObject *exc, const char *fmt,...)
1717
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
1818

19-
extern void PLy_exception_set_plural(PyObject *, const char *, const char *,
19+
extern void PLy_exception_set_plural(PyObject *exc, const char *fmt_singular, const char *fmt_plural,
2020
unsigned long n,...)
2121
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 5)))
2222
__attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 5)));

src/pl/plpython/plpy_exec.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@
2525
#include "plpy_subxactobject.h"
2626

2727

28-
static PyObject *PLy_function_build_args(FunctionCallInfo, PLyProcedure *);
29-
static void PLy_function_delete_args(PLyProcedure *);
30-
static void plpython_return_error_callback(void *);
31-
32-
static PyObject *PLy_trigger_build_args(FunctionCallInfo, PLyProcedure *,
33-
HeapTuple *);
34-
static HeapTuple PLy_modify_tuple(PLyProcedure *, PyObject *,
35-
TriggerData *, HeapTuple);
36-
static void plpython_trigger_error_callback(void *);
37-
38-
static PyObject *PLy_procedure_call(PLyProcedure *, char *, PyObject *);
39-
static void PLy_abort_open_subtransactions(int);
28+
static PyObject *PLy_function_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc);
29+
static void PLy_function_delete_args(PLyProcedure *proc);
30+
static void plpython_return_error_callback(void *arg);
31+
32+
static PyObject *PLy_trigger_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc,
33+
HeapTuple *rv);
34+
static HeapTuple PLy_modify_tuple(PLyProcedure *proc, PyObject *pltd,
35+
TriggerData *tdata, HeapTuple otup);
36+
static void plpython_trigger_error_callback(void *arg);
37+
38+
static PyObject *PLy_procedure_call(PLyProcedure *proc, char *kargs, PyObject *vargs);
39+
static void PLy_abort_open_subtransactions(int save_subxact_level);
4040

4141

4242
/* function subhandler */

src/pl/plpython/plpy_exec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include "plpy_procedure.h"
99

10-
extern Datum PLy_exec_function(FunctionCallInfo, PLyProcedure *);
11-
extern HeapTuple PLy_exec_trigger(FunctionCallInfo, PLyProcedure *);
10+
extern Datum PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc);
11+
extern HeapTuple PLy_exec_trigger(FunctionCallInfo fcinfo, PLyProcedure *proc);
1212

1313
#endif /* PLPY_EXEC_H */

src/pl/plpython/plpy_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ PG_FUNCTION_INFO_V1(plpython2_inline_handler);
6161
#endif
6262

6363

64-
static bool PLy_procedure_is_trigger(Form_pg_proc);
65-
static void plpython_error_callback(void *);
66-
static void plpython_inline_error_callback(void *);
64+
static bool PLy_procedure_is_trigger(Form_pg_proc procStruct);
65+
static void plpython_error_callback(void *arg);
66+
static void plpython_inline_error_callback(void *arg);
6767
static void PLy_init_interp(void);
6868

6969
static const int plpython_python_version = PY_MAJOR_VERSION;

src/pl/plpython/plpy_planobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#include "plpy_elog.h"
1414

1515

16-
static void PLy_plan_dealloc(PyObject *);
17-
static PyObject *PLy_plan_status(PyObject *, PyObject *);
16+
static void PLy_plan_dealloc(PyObject *arg);
17+
static PyObject *PLy_plan_status(PyObject *self, PyObject *args);
1818

1919
static char PLy_plan_doc[] = {
2020
"Store a PostgreSQL plan"

src/pl/plpython/plpy_planobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ typedef struct PLyPlanObject
2121

2222
extern void PLy_plan_init_type(void);
2323
extern PyObject *PLy_plan_new(void);
24-
extern bool is_PLyPlanObject(PyObject *);
24+
extern bool is_PLyPlanObject(PyObject *ob);
2525

2626
#endif /* PLPY_PLANOBJECT_H */

src/pl/plpython/plpy_plpymodule.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@
2424
HTAB *PLy_spi_exceptions = NULL;
2525

2626

27-
static void PLy_add_exceptions(PyObject *);
28-
static void PLy_generate_spi_exceptions(PyObject *, PyObject *);
27+
static void PLy_add_exceptions(PyObject *plpy);
28+
static void PLy_generate_spi_exceptions(PyObject *mod, PyObject *base);
2929

3030
/* module functions */
31-
static PyObject *PLy_debug(PyObject *, PyObject *);
32-
static PyObject *PLy_log(PyObject *, PyObject *);
33-
static PyObject *PLy_info(PyObject *, PyObject *);
34-
static PyObject *PLy_notice(PyObject *, PyObject *);
35-
static PyObject *PLy_warning(PyObject *, PyObject *);
36-
static PyObject *PLy_error(PyObject *, PyObject *);
37-
static PyObject *PLy_fatal(PyObject *, PyObject *);
38-
static PyObject *PLy_quote_literal(PyObject *, PyObject *);
39-
static PyObject *PLy_quote_nullable(PyObject *, PyObject *);
40-
static PyObject *PLy_quote_ident(PyObject *, PyObject *);
31+
static PyObject *PLy_debug(PyObject *self, PyObject *args);
32+
static PyObject *PLy_log(PyObject *self, PyObject *args);
33+
static PyObject *PLy_info(PyObject *self, PyObject *args);
34+
static PyObject *PLy_notice(PyObject *self, PyObject *args);
35+
static PyObject *PLy_warning(PyObject *self, PyObject *args);
36+
static PyObject *PLy_error(PyObject *self, PyObject *args);
37+
static PyObject *PLy_fatal(PyObject *self, PyObject *args);
38+
static PyObject *PLy_quote_literal(PyObject *self, PyObject *args);
39+
static PyObject *PLy_quote_nullable(PyObject *self, PyObject *args);
40+
static PyObject *PLy_quote_ident(PyObject *self, PyObject *args);
4141

4242

4343
/* A list of all known exceptions, generated from backend/utils/errcodes.txt */

0 commit comments

Comments
 (0)
0