1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-20 00:42:27 +03:00

Initial pgindent run with pg_bsd_indent version 2.0.

The new indent version includes numerous fixes thanks to Piotr Stefaniak.
The main changes visible in this commit are:

* Nicer formatting of function-pointer declarations.
* No longer unexpectedly removes spaces in expressions using casts,
  sizeof, or offsetof.
* No longer wants to add a space in "struct structname *varname", as
  well as some similar cases for const- or volatile-qualified pointers.
* Declarations using PG_USED_FOR_ASSERTS_ONLY are formatted more nicely.
* Fixes bug where comments following declarations were sometimes placed
  with no space separating them from the code.
* Fixes some odd decisions for comments following case labels.
* Fixes some cases where comments following code were indented to less
  than the expected column 33.

On the less good side, it now tends to put more whitespace around typedef
names that are not listed in typedefs.list.  This might encourage us to
put more effort into typedef name collection; it's not really a bug in
indent itself.

There are more changes coming after this round, having to do with comment
indentation and alignment of lines appearing within parentheses.  I wanted
to limit the size of the diffs to something that could be reviewed without
one's eyes completely glazing over, so it seemed better to split up the
changes as much as practical.

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:
Tom Lane 2017-06-21 14:39:04 -04:00
parent 8ff6d4ec78
commit e3860ffa4d
379 changed files with 1725 additions and 1707 deletions

View File

@ -61,6 +61,7 @@ typedef struct mpz
mp_size used;
mp_sign sign;
} mpz_t ,
*mp_int;
#define MP_DIGITS(Z) ((Z)->digits)

View File

@ -44,8 +44,7 @@ typedef struct _rijndael_ctx
/* These are all based on 32 bit unsigned values and will therefore */
/* require endian conversions for big-endian architectures */
rijndael_ctx *
rijndael_set_key(rijndael_ctx *, const u4byte *, const u4byte, int);
rijndael_ctx *rijndael_set_key(rijndael_ctx *, const u4byte *, const u4byte, int);
void rijndael_encrypt(rijndael_ctx *, const u4byte *, u4byte *);
void rijndael_decrypt(rijndael_ctx *, const u4byte *, u4byte *);

View File

@ -92,9 +92,9 @@ typedef enum
typedef struct BTParallelScanDescData
{
BlockNumber btps_scanPage; /* latest or next page to be scanned */
BTPS_State btps_pageStatus;/* indicates whether next page is available
* for scan. see above for possible states of
* parallel scan. */
BTPS_State btps_pageStatus; /* indicates whether next page is
* available for scan. see above for
* possible states of parallel scan. */
int btps_arrayKeyCount; /* count indicating number of array
* scan keys processed by parallel
* scan */

View File

@ -80,9 +80,9 @@ typedef struct PartitionBoundInfoData
int ndatums; /* Length of the datums following array */
Datum **datums; /* Array of datum-tuples with key->partnatts
* datums each */
RangeDatumContent **content;/* what's contained in each range bound datum?
* (see the above enum); NULL for list
* partitioned tables */
RangeDatumContent **content; /* what's contained in each range bound
* datum? (see the above enum); NULL for
* list partitioned tables */
int *indexes; /* Partition indexes; one entry per member of
* the datums array (plus one if range
* partitioned table) */

View File

@ -75,7 +75,8 @@ typedef struct ExtensionControlFile
char *name; /* name of the extension */
char *directory; /* directory for script files */
char *default_version; /* default install target version, if any */
char *module_pathname; /* string to substitute for MODULE_PATHNAME */
char *module_pathname; /* string to substitute for
* MODULE_PATHNAME */
char *comment; /* comment, if any */
char *schema; /* target schema (allowed if !relocatable) */
bool relocatable; /* is ALTER EXTENSION SET SCHEMA supported? */

View File

@ -3358,8 +3358,7 @@ AlterTableGetLockLevel(List *cmds)
cmd_lockmode = AccessExclusiveLock;
break;
case AT_ValidateConstraint: /* Uses MVCC in
* getConstraints() */
case AT_ValidateConstraint: /* Uses MVCC in getConstraints() */
cmd_lockmode = ShareUpdateExclusiveLock;
break;
@ -3469,8 +3468,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
/* Recursion occurs during execution phase */
pass = AT_PASS_ADD_COL;
break;
case AT_AddColumnToView: /* add column via CREATE OR REPLACE
* VIEW */
case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */
ATSimplePermissions(rel, ATT_VIEW);
ATPrepAddColumn(wqueue, rel, recurse, recursing, true, cmd,
lockmode);
@ -3813,8 +3811,7 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel,
switch (cmd->subtype)
{
case AT_AddColumn: /* ADD COLUMN */
case AT_AddColumnToView: /* add column via CREATE OR REPLACE
* VIEW */
case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */
address = ATExecAddColumn(wqueue, tab, rel, (ColumnDef *) cmd->def,
false, false, false,
false, lockmode);
@ -3882,8 +3879,7 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel,
ATExecAddConstraint(wqueue, tab, rel, (Constraint *) cmd->def,
true, false, lockmode);
break;
case AT_ReAddConstraint: /* Re-add pre-existing check
* constraint */
case AT_ReAddConstraint: /* Re-add pre-existing check constraint */
address =
ATExecAddConstraint(wqueue, tab, rel, (Constraint *) cmd->def,
true, true, lockmode);

View File

@ -1337,6 +1337,7 @@ pg_SSPI_recvauth(Port *port)
DWORD domainnamesize = sizeof(domainname);
SID_NAME_USE accountnameuse;
HMODULE secur32;
QUERY_SECURITY_CONTEXT_TOKEN_FN _QuerySecurityContextToken;
/*

View File

@ -340,6 +340,7 @@ static PMState pmState = PM_INIT;
/* Start time of SIGKILL timeout during immediate shutdown or child crash */
/* Zero means timeout is not running */
static time_t AbortStartTime = 0;
/* Length of said timeout */
#define SIGKILL_CHILDREN_AFTER_SECS 5

View File

@ -180,8 +180,7 @@ static void AssertTXNLsnOrder(ReorderBuffer *rb);
* ---------------------------------------
*/
static ReorderBufferIterTXNState *ReorderBufferIterTXNInit(ReorderBuffer *rb, ReorderBufferTXN *txn);
static ReorderBufferChange *
ReorderBufferIterTXNNext(ReorderBuffer *rb, ReorderBufferIterTXNState *state);
static ReorderBufferChange *ReorderBufferIterTXNNext(ReorderBuffer *rb, ReorderBufferIterTXNState *state);
static void ReorderBufferIterTXNFinish(ReorderBuffer *rb,
ReorderBufferIterTXNState *state);
static void ReorderBufferExecuteInvalidations(ReorderBuffer *rb, ReorderBufferTXN *txn);

View File

@ -117,7 +117,8 @@ bool am_cascading_walsender = false; /* Am I cascading WAL to
bool am_db_walsender = false; /* Connected to a database? */
/* User-settable parameters for walsender */
int max_wal_senders = 0; /* the maximum number of concurrent walsenders */
int max_wal_senders = 0; /* the maximum number of concurrent
* walsenders */
int wal_sender_timeout = 60 * 1000; /* maximum time to send one
* WAL data message */
bool log_replication_commands = false;

View File

@ -84,7 +84,8 @@ typedef struct GetState
char **path_names; /* field name(s) being sought */
int *path_indexes; /* array index(es) being sought */
bool *pathok; /* is path matched to current depth? */
int *array_cur_index; /* current element index at each path level */
int *array_cur_index; /* current element index at each path
* level */
} GetState;
/* state for json_array_length */

View File

@ -4221,7 +4221,8 @@ convert_string_datum(Datum value, Oid typid)
/*
*
* http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?
* FeedbackID=99694 */
* FeedbackID=99694
*/
{
char x[1];

View File

@ -1015,7 +1015,8 @@ tsqueryrecv(PG_FUNCTION_ARGS)
if (item->type == QI_VAL)
{
size_t val_len; /* length after recoding to server encoding */
size_t val_len; /* length after recoding to server
* encoding */
uint8 weight;
uint8 prefix;
const char *val;

View File

@ -910,7 +910,7 @@ calc_rank_cd(const float4 *arrdata, TSVector txt, TSQuery query, int method)
CurExtPos = ((double) (ext.q + ext.p)) / 2.0;
if (NExtent > 0 && CurExtPos > PrevExtPos /* prevent division by
* zero in a case of
multiple lexize */ )
* multiple lexize */ )
SumDist += 1.0 / (CurExtPos - PrevExtPos);
PrevExtPos = CurExtPos;

View File

@ -58,8 +58,8 @@ strtokx(const char *s,
bool del_quotes,
int encoding)
{
static char *storage = NULL;/* store the local copy of the users string
* here */
static char *storage = NULL; /* store the local copy of the users
* string here */
static char *string = NULL; /* pointer into storage where to continue on
* next call */

View File

@ -604,6 +604,7 @@ appendPsqlMetaConnect(PQExpBuffer buf, const char *dbname)
* general case. No database has a zero-length name.
*/
complex = false;
for (s = dbname; *s; s++)
{
if (*s == '\n' || *s == '\r')

View File

@ -32,11 +32,11 @@
#define REGBUF_WILL_INIT (0x04 | 0x02) /* page will be re-initialized
* at replay (implies
* NO_IMAGE) */
#define REGBUF_STANDARD 0x08/* page follows "standard" page layout, (data
* between pd_lower and pd_upper will be
* skipped) */
#define REGBUF_KEEP_DATA 0x10/* include data even if a full-page image is
* taken */
#define REGBUF_STANDARD 0x08 /* page follows "standard" page layout,
* (data between pd_lower and pd_upper
* will be skipped) */
#define REGBUF_KEEP_DATA 0x10 /* include data even if a full-page image
* is taken */
/* prototypes for public functions in xloginsert.c: */
extern void XLogBeginInsert(void);

View File

@ -146,7 +146,8 @@ typedef struct XLogRecordBlockImageHeader
/* Information stored in bimg_info */
#define BKPIMAGE_HAS_HOLE 0x01 /* page image has "hole" */
#define BKPIMAGE_IS_COMPRESSED 0x02 /* page image is compressed */
#define BKPIMAGE_APPLY 0x04 /* page image should be restored during replay */
#define BKPIMAGE_APPLY 0x04 /* page image should be restored during
* replay */
/*
* Extra header information used when page image has "hole" and

View File

@ -34,7 +34,8 @@ CATALOG(pg_largeobject,2613) BKI_WITHOUT_OIDS
int32 pageno; /* Page number (starting from 0) */
/* data has variable length, but we allow direct access; see inv_api.c */
bytea data BKI_FORCE_NOT_NULL; /* Data for page (may be zero-length) */
bytea data BKI_FORCE_NOT_NULL; /* Data for page (may be
* zero-length) */
} FormData_pg_largeobject;
/* ----------------

View File

@ -28,7 +28,8 @@ CATALOG(pg_seclabel,3596) BKI_WITHOUT_OIDS
#ifdef CATALOG_VARLEN /* variable-length fields start here */
text provider BKI_FORCE_NOT_NULL; /* name of label provider */
text label BKI_FORCE_NOT_NULL; /* security label of the object */
text label BKI_FORCE_NOT_NULL; /* security label of the
* object */
#endif
} FormData_pg_seclabel;

View File

@ -28,7 +28,8 @@ CATALOG(pg_shseclabel,3592) BKI_SHARED_RELATION BKI_ROWTYPE_OID(4066) BKI_WITHOU
#ifdef CATALOG_VARLEN /* variable-length fields start here */
text provider BKI_FORCE_NOT_NULL; /* name of label provider */
text label BKI_FORCE_NOT_NULL; /* security label of the object */
text label BKI_FORCE_NOT_NULL; /* security label of the
* object */
#endif
} FormData_pg_shseclabel;

View File

@ -26,7 +26,8 @@ typedef struct
} pg_unicode_decomposition;
#define DECOMP_NO_COMPOSE 0x80 /* don't use for re-composition */
#define DECOMP_INLINE 0x40 /* decomposition is stored inline in dec_index */
#define DECOMP_INLINE 0x40 /* decomposition is stored inline in
* dec_index */
#define DECOMPOSITION_SIZE(x) ((x)->dec_size_flags & 0x3F)
#define DECOMPOSITION_NO_COMPOSE(x) (((x)->dec_size_flags & DECOMP_NO_COMPOSE) != 0)

View File

@ -96,14 +96,14 @@ struct separator
typedef struct printTableOpt
{
enum printFormat format; /* see enum above */
unsigned short int expanded;/* expanded/vertical output (if supported by
* output format); 0=no, 1=yes, 2=auto */
unsigned short int expanded; /* expanded/vertical output (if supported
* by output format); 0=no, 1=yes, 2=auto */
unsigned short int border; /* Print a border around the table. 0=none,
* 1=dividing lines, 2=full */
unsigned short int pager; /* use pager for output (if to stdout and
* stdout is a tty) 0=off 1=on 2=always */
int pager_min_lines;/* don't use pager unless there are at least
* this many lines */
int pager_min_lines; /* don't use pager unless there are at
* least this many lines */
bool tuples_only; /* don't output headers, row counts, etc. */
bool start_table; /* print start decoration, eg <table> */
bool stop_table; /* print stop decoration, eg </table> */

View File

@ -133,10 +133,12 @@ typedef unsigned int pg_wchar;
#define LC_JISX0212 0x94 /* Japanese Kanji (JIS X 0212) */
#define LC_CNS11643_1 0x95 /* CNS 11643-1992 Plane 1 */
#define LC_CNS11643_2 0x96 /* CNS 11643-1992 Plane 2 */
#define LC_JISX0213_1 0x97/* Japanese Kanji (JIS X 0213 Plane 1) (not
#define LC_JISX0213_1 0x97 /* Japanese Kanji (JIS X 0213 Plane 1)
* (not supported) */
#define LC_BIG5_1 0x98 /* Plane 1 Chinese traditional (not
* supported) */
#define LC_BIG5_2 0x99 /* Plane 1 Chinese traditional (not
* supported) */
#define LC_BIG5_1 0x98 /* Plane 1 Chinese traditional (not supported) */
#define LC_BIG5_2 0x99 /* Plane 1 Chinese traditional (not supported) */
/* Is a leading byte for "official" multibyte encodings? */
#define IS_LC2(c) ((unsigned char)(c) >= 0x90 && (unsigned char)(c) <= 0x99)
@ -170,8 +172,8 @@ typedef unsigned int pg_wchar;
*/
#define LC_SISHENG 0xa0 /* Chinese SiSheng characters for
* PinYin/ZhuYin (not supported) */
#define LC_IPA 0xa1/* IPA (International Phonetic Association)
* (not supported) */
#define LC_IPA 0xa1 /* IPA (International Phonetic
* Association) (not supported) */
#define LC_VISCII_LOWER 0xa2 /* Vietnamese VISCII1.1 lower-case (not
* supported) */
#define LC_VISCII_UPPER 0xa3 /* Vietnamese VISCII1.1 upper-case (not
@ -181,15 +183,15 @@ typedef unsigned int pg_wchar;
#define LC_ASCII_RIGHT_TO_LEFT 0xa6 /* ASCII (left half of ISO8859-1) with
* right-to-left direction (not
* supported) */
#define LC_LAO 0xa7/* Lao characters (ISO10646 0E80..0EDF) (not
* supported) */
#define LC_LAO 0xa7 /* Lao characters (ISO10646 0E80..0EDF)
* (not supported) */
#define LC_ARABIC_2_COLUMN 0xa8 /* Arabic 1-column (not supported) */
/*
* Charset IDs for private multibyte encodings (0xf0-0xff)
*/
#define LC_INDIAN_1_COLUMN 0xf0/* Indian charset for 1-column width glyphs
* (not supported) */
#define LC_INDIAN_1_COLUMN 0xf0 /* Indian charset for 1-column width
* glyphs (not supported) */
#define LC_TIBETAN_1_COLUMN 0xf1 /* Tibetan 1-column width glyphs (not
* supported) */
#define LC_UNICODE_SUBSET_2 0xf2 /* Unicode characters of the range
@ -204,8 +206,8 @@ typedef unsigned int pg_wchar;
#define LC_CNS11643_5 0xf8 /* CNS 11643-1992 Plane 5 */
#define LC_CNS11643_6 0xf9 /* CNS 11643-1992 Plane 6 */
#define LC_CNS11643_7 0xfa /* CNS 11643-1992 Plane 7 */
#define LC_INDIAN_2_COLUMN 0xfb/* Indian charset for 2-column width glyphs
* (not supported) */
#define LC_INDIAN_2_COLUMN 0xfb /* Indian charset for 2-column width
* glyphs (not supported) */
#define LC_TIBETAN 0xfc /* Tibetan (not supported) */
/* #define FREE 0xfd free (unused) */
/* #define FREE 0xfe free (unused) */

View File

@ -1831,12 +1831,12 @@ typedef struct WindowAggState
bool partition_spooled; /* true if all tuples in current
* partition have been spooled into
* tuplestore */
bool more_partitions;/* true if there's more partitions after this
* one */
bool framehead_valid;/* true if frameheadpos is known up to date
* for current row */
bool frametail_valid;/* true if frametailpos is known up to date
* for current row */
bool more_partitions; /* true if there's more partitions after
* this one */
bool framehead_valid; /* true if frameheadpos is known up to
* date for current row */
bool frametail_valid; /* true if frametailpos is known up to
* date for current row */
TupleTableSlot *first_part_slot; /* first tuple of current or next
* partition */

View File

@ -614,6 +614,7 @@ extern int16 *readAttrNumberCols(int numCols);
* nodes/copyfuncs.c
*/
extern void *copyObjectImpl(const void *obj);
/* cast result back to argument type, if supported by compiler */
#ifdef HAVE_TYPEOF
#define copyObject(obj) ((typeof(obj)) copyObjectImpl(obj))

View File

@ -2099,7 +2099,8 @@ typedef struct Constraint
char fk_upd_action; /* ON UPDATE action */
char fk_del_action; /* ON DELETE action */
List *old_conpfeqop; /* pg_constraint.conpfeqop of my former self */
Oid old_pktable_oid; /* pg_constraint.confrelid of my former self */
Oid old_pktable_oid; /* pg_constraint.confrelid of my former
* self */
/* Fields used for constraints that allow a NOT VALID specification */
bool skip_validation; /* skip validation of existing rows? */

View File

@ -400,10 +400,11 @@ typedef struct ArrayRef
Oid refelemtype; /* type of the array elements */
int32 reftypmod; /* typmod of the array (and elements too) */
Oid refcollid; /* OID of collation, or InvalidOid if none */
List *refupperindexpr;/* expressions that evaluate to upper array
* indexes */
List *reflowerindexpr;/* expressions that evaluate to lower array
* indexes, or NIL for single array element */
List *refupperindexpr; /* expressions that evaluate to upper
* array indexes */
List *reflowerindexpr; /* expressions that evaluate to lower
* array indexes, or NIL for single array
* element */
Expr *refexpr; /* the expression that evaluates to an array
* value */
Expr *refassgnexpr; /* expression for the source value, or NULL if

View File

@ -577,7 +577,8 @@ typedef struct RelOptInfo
void *fdw_private;
/* cache space for remembering if we have proven this relation unique */
List *unique_for_rels; /* known unique for these other relid set(s) */
List *unique_for_rels; /* known unique for these other relid
* set(s) */
List *non_unique_for_rels; /* known not unique for these set(s) */
/* used by various scans and joins: */
@ -655,10 +656,11 @@ typedef struct IndexOptInfo
List *indextlist; /* targetlist representing index columns */
List *indrestrictinfo;/* parent relation's baserestrictinfo list,
* less any conditions implied by the index's
* predicate (unless it's a target rel, see
* comments in check_index_predicates()) */
List *indrestrictinfo; /* parent relation's baserestrictinfo
* list, less any conditions implied by
* the index's predicate (unless it's a
* target rel, see comments in
* check_index_predicates()) */
bool predOK; /* true if index predicate matches query */
bool unique; /* true if a unique index */

View File

@ -119,9 +119,7 @@ extern bool RegisterDynamicBackgroundWorker(BackgroundWorker *worker,
/* Query the status of a bgworker */
extern BgwHandleStatus GetBackgroundWorkerPid(BackgroundWorkerHandle *handle,
pid_t *pidp);
extern BgwHandleStatus
WaitForBackgroundWorkerStartup(BackgroundWorkerHandle *
handle, pid_t *pid);
extern BgwHandleStatus WaitForBackgroundWorkerStartup(BackgroundWorkerHandle *handle, pid_t *pid);
extern BgwHandleStatus
WaitForBackgroundWorkerShutdown(BackgroundWorkerHandle *);

View File

@ -28,6 +28,7 @@ typedef struct MVNDistinctItem
double ndistinct; /* ndistinct value for this combination */
Bitmapset *attrs; /* attr numbers of items */
} MVNDistinctItem;
/* size of the struct, excluding attribute list */
#define SizeOfMVNDistinctItem \
(offsetof(MVNDistinctItem, ndistinct) + sizeof(double))

View File

@ -38,6 +38,7 @@ typedef struct ItemPointerData
BlockIdData ip_blkid;
OffsetNumber ip_posid;
}
/* If compiler understands packed and aligned pragmas, use those */
#if defined(pg_attribute_packed) && defined(pg_attribute_aligned)
pg_attribute_packed()

View File

@ -307,6 +307,7 @@ unsigned char *cp;
C_block *out;
C_block *p;
int chars_in;
{
DCL_BLOCK(D, D0, D1);
C_block *tp;
@ -977,6 +978,7 @@ C_block perm[64 / CHUNKBITS][1 << CHUNKBITS];
unsigned char p[64];
int chars_in,
chars_out;
{
int i,
j,
@ -1068,6 +1070,7 @@ prtab(s, t, num_rows)
char *s;
unsigned char *t;
int num_rows;
{
int i,
j;