mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
Phase 2 of pgindent updates.
Change pg_bsd_indent to follow upstream rules for placement of comments
to the right of code, and remove pgindent hack that caused comments
following #endif to not obey the general rule.
Commit e3860ffa4d
wasn't actually using
the published version of pg_bsd_indent, but a hacked-up version that
tried to minimize the amount of movement of comments to the right of
code. The situation of interest is where such a comment has to be
moved to the right of its default placement at column 33 because there's
code there. BSD indent has always moved right in units of tab stops
in such cases --- but in the previous incarnation, indent was working
in 8-space tab stops, while now it knows we use 4-space tabs. So the
net result is that in about half the cases, such comments are placed
one tab stop left of before. This is better all around: it leaves
more room on the line for comment text, and it means that in such
cases the comment uniformly starts at the next 4-space tab stop after
the code, rather than sometimes one and sometimes two tabs after.
Also, ensure that comments following #endif are indented the same
as comments following other preprocessor commands such as #else.
That inconsistency turns out to have been self-inflicted damage
from a poorly-thought-through post-indent "fixup" in pgindent.
This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.
Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
This commit is contained in:
@ -21,4 +21,4 @@ extern void PLy_cursor_init_type(void);
|
||||
extern PyObject *PLy_cursor(PyObject *self, PyObject *args);
|
||||
extern PyObject *PLy_cursor_plan(PyObject *ob, PyObject *args);
|
||||
|
||||
#endif /* PLPY_CURSOROBJECT_H */
|
||||
#endif /* PLPY_CURSOROBJECT_H */
|
||||
|
@ -19,4 +19,4 @@ extern void PLy_exception_set_plural(PyObject *exc, const char *fmt_singular, co
|
||||
|
||||
extern void PLy_exception_set_with_details(PyObject *excclass, ErrorData *edata);
|
||||
|
||||
#endif /* PLPY_ELOG_H */
|
||||
#endif /* PLPY_ELOG_H */
|
||||
|
@ -31,7 +31,7 @@ typedef struct PLySRFState
|
||||
{
|
||||
PyObject *iter; /* Python iterator producing results */
|
||||
PLySavedArgs *savedargs; /* function argument values */
|
||||
MemoryContextCallback callback; /* for releasing refcounts when done */
|
||||
MemoryContextCallback callback; /* for releasing refcounts when done */
|
||||
} PLySRFState;
|
||||
|
||||
static PyObject *PLy_function_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc);
|
||||
|
@ -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 */
|
||||
|
@ -214,7 +214,7 @@ plpython2_validator(PG_FUNCTION_ARGS)
|
||||
/* call plpython validator with our fcinfo so it gets our oid */
|
||||
return plpython_validator(fcinfo);
|
||||
}
|
||||
#endif /* PY_MAJOR_VERSION < 3 */
|
||||
#endif /* PY_MAJOR_VERSION < 3 */
|
||||
|
||||
Datum
|
||||
plpython_call_handler(PG_FUNCTION_ARGS)
|
||||
@ -288,7 +288,7 @@ plpython2_call_handler(PG_FUNCTION_ARGS)
|
||||
{
|
||||
return plpython_call_handler(fcinfo);
|
||||
}
|
||||
#endif /* PY_MAJOR_VERSION < 3 */
|
||||
#endif /* PY_MAJOR_VERSION < 3 */
|
||||
|
||||
Datum
|
||||
plpython_inline_handler(PG_FUNCTION_ARGS)
|
||||
@ -368,7 +368,7 @@ plpython2_inline_handler(PG_FUNCTION_ARGS)
|
||||
{
|
||||
return plpython_inline_handler(fcinfo);
|
||||
}
|
||||
#endif /* PY_MAJOR_VERSION < 3 */
|
||||
#endif /* PY_MAJOR_VERSION < 3 */
|
||||
|
||||
static bool
|
||||
PLy_procedure_is_trigger(Form_pg_proc procStruct)
|
||||
|
@ -28,4 +28,4 @@ extern PLyExecutionContext *PLy_current_execution_context(void);
|
||||
/* Get the scratch memory context for specified execution context */
|
||||
extern MemoryContext PLy_get_scratch_context(PLyExecutionContext *context);
|
||||
|
||||
#endif /* PLPY_MAIN_H */
|
||||
#endif /* PLPY_MAIN_H */
|
||||
|
@ -24,4 +24,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 */
|
||||
|
@ -140,7 +140,7 @@ PyInit_plpy(void)
|
||||
|
||||
return m;
|
||||
}
|
||||
#endif /* PY_MAJOR_VERSION >= 3 */
|
||||
#endif /* PY_MAJOR_VERSION >= 3 */
|
||||
|
||||
void
|
||||
PLy_init_plpy(void)
|
||||
|
@ -16,4 +16,4 @@ PyMODINIT_FUNC PyInit_plpy(void);
|
||||
#endif
|
||||
extern void PLy_init_plpy(void);
|
||||
|
||||
#endif /* PLPY_PLPYMODULE_H */
|
||||
#endif /* PLPY_PLPYMODULE_H */
|
||||
|
@ -17,7 +17,7 @@ typedef struct PLySavedArgs
|
||||
struct PLySavedArgs *next; /* linked-list pointer */
|
||||
PyObject *args; /* "args" element of globals dict */
|
||||
int nargs; /* length of namedargs array */
|
||||
PyObject *namedargs[FLEXIBLE_ARRAY_MEMBER]; /* named args */
|
||||
PyObject *namedargs[FLEXIBLE_ARRAY_MEMBER]; /* named args */
|
||||
} PLySavedArgs;
|
||||
|
||||
/* cached procedure data */
|
||||
@ -66,4 +66,4 @@ extern PLyProcedure *PLy_procedure_get(Oid fn_oid, Oid fn_rel, 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 */
|
||||
|
@ -22,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 */
|
||||
|
@ -23,4 +23,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 */
|
||||
|
@ -29,4 +29,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 */
|
||||
|
@ -119,4 +119,4 @@ extern PyObject *PLyDict_FromTuple(PLyTypeInfo *info, HeapTuple tuple, TupleDesc
|
||||
/* conversion from Python objects to C strings */
|
||||
extern char *PLyObject_AsString(PyObject *plrv);
|
||||
|
||||
#endif /* PLPY_TYPEIO_H */
|
||||
#endif /* PLPY_TYPEIO_H */
|
||||
|
@ -132,4 +132,4 @@ PLyUnicode_FromString(const char *s)
|
||||
return PLyUnicode_FromStringAndSize(s, strlen(s));
|
||||
}
|
||||
|
||||
#endif /* PY_MAJOR_VERSION >= 3 */
|
||||
#endif /* PY_MAJOR_VERSION >= 3 */
|
||||
|
@ -14,4 +14,4 @@ extern PyObject *PLyUnicode_FromString(const char *s);
|
||||
extern PyObject *PLyUnicode_FromStringAndSize(const char *s, Py_ssize_t size);
|
||||
#endif
|
||||
|
||||
#endif /* PLPY_UTIL_H */
|
||||
#endif /* PLPY_UTIL_H */
|
||||
|
@ -138,8 +138,8 @@ typedef int Py_ssize_t;
|
||||
#else
|
||||
#define vsnprintf pg_vsnprintf
|
||||
#define snprintf pg_snprintf
|
||||
#endif /* __GNUC__ */
|
||||
#endif /* USE_REPL_SNPRINTF */
|
||||
#endif /* __GNUC__ */
|
||||
#endif /* USE_REPL_SNPRINTF */
|
||||
|
||||
/*
|
||||
* Used throughout, and also by the Python 2/3 porting layer, so it's easier to
|
||||
@ -147,4 +147,4 @@ typedef int Py_ssize_t;
|
||||
*/
|
||||
#include "plpy_util.h"
|
||||
|
||||
#endif /* PLPYTHON_H */
|
||||
#endif /* PLPYTHON_H */
|
||||
|
Reference in New Issue
Block a user