Skip to content

Commit c7b8998

Browse files
committed
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 e3860ff 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/[email protected] Discussion: https://postgr.es/m/[email protected]
1 parent f669c09 commit c7b8998

File tree

1,107 files changed

+3435
-3516
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,107 files changed

+3435
-3516
lines changed

contrib/bloom/bloom.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ typedef BloomPageOpaqueData *BloomPageOpaque;
7575

7676
/* Preserved page numbers */
7777
#define BLOOM_METAPAGE_BLKNO (0)
78-
#define BLOOM_HEAD_BLKNO (1) /* first data page */
78+
#define BLOOM_HEAD_BLKNO (1) /* first data page */
7979

8080
/*
8181
* We store Bloom signatures as arrays of uint16 words.
@@ -101,8 +101,8 @@ typedef struct BloomOptions
101101
{
102102
int32 vl_len_; /* varlena header (do not touch directly!) */
103103
int bloomLength; /* length of signature in words (not bits!) */
104-
int bitSize[INDEX_MAX_KEYS]; /* # of bits generated for
105-
* each index key */
104+
int bitSize[INDEX_MAX_KEYS]; /* # of bits generated for each
105+
* index key */
106106
} BloomOptions;
107107

108108
/*

contrib/btree_gist/btree_utils_num.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ typedef struct
4242

4343
/* Methods */
4444

45-
bool (*f_gt) (const void *, const void *, FmgrInfo *); /* greater than */
46-
bool (*f_ge) (const void *, const void *, FmgrInfo *); /* greater or equal */
47-
bool (*f_eq) (const void *, const void *, FmgrInfo *); /* equal */
48-
bool (*f_le) (const void *, const void *, FmgrInfo *); /* less or equal */
49-
bool (*f_lt) (const void *, const void *, FmgrInfo *); /* less than */
50-
int (*f_cmp) (const void *, const void *, FmgrInfo *); /* key compare function */
51-
float8 (*f_dist) (const void *, const void *, FmgrInfo *); /* key distance function */
45+
bool (*f_gt) (const void *, const void *, FmgrInfo *); /* greater than */
46+
bool (*f_ge) (const void *, const void *, FmgrInfo *); /* greater or equal */
47+
bool (*f_eq) (const void *, const void *, FmgrInfo *); /* equal */
48+
bool (*f_le) (const void *, const void *, FmgrInfo *); /* less or equal */
49+
bool (*f_lt) (const void *, const void *, FmgrInfo *); /* less than */
50+
int (*f_cmp) (const void *, const void *, FmgrInfo *); /* key compare function */
51+
float8 (*f_dist) (const void *, const void *, FmgrInfo *); /* key distance function */
5252
} gbtree_ninfo;
5353

5454

contrib/btree_gist/btree_utils_var.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
488488

489489
cur = (char *) DatumGetPointer(entryvec->vector[i].key);
490490
ro = gbt_var_key_readable((GBT_VARKEY *) cur);
491-
if (ro.lower == ro.upper) /* leaf */
491+
if (ro.lower == ro.upper) /* leaf */
492492
{
493493
sv[svcntr] = gbt_var_leaf2node((GBT_VARKEY *) cur, tinfo, flinfo);
494494
arr[i].t = sv[svcntr];

contrib/btree_gist/btree_utils_var.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ typedef struct
4040
bool (*f_le) (const void *, const void *, Oid, FmgrInfo *); /* less equal */
4141
bool (*f_lt) (const void *, const void *, Oid, FmgrInfo *); /* less than */
4242
int32 (*f_cmp) (const void *, const void *, Oid, FmgrInfo *); /* compare */
43-
GBT_VARKEY *(*f_l2n) (GBT_VARKEY *, FmgrInfo *flinfo); /* convert leaf to node */
43+
GBT_VARKEY *(*f_l2n) (GBT_VARKEY *, FmgrInfo *flinfo); /* convert leaf to node */
4444
} gbtree_vinfo;
4545

4646

contrib/btree_gist/btree_uuid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static double
171171
uuid_2_double(const pg_uuid_t *u)
172172
{
173173
uint64 uu[2];
174-
const double two64 = 18446744073709551616.0; /* 2^64 */
174+
const double two64 = 18446744073709551616.0; /* 2^64 */
175175

176176
/* Source data may not be suitably aligned, so copy */
177177
memcpy(uu, u->data, UUID_LEN);

contrib/cube/cubedata.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ typedef struct NDBOX
5454
#define PG_RETURN_NDBOX(x) PG_RETURN_POINTER(x)
5555

5656
/* GiST operator strategy numbers */
57-
#define CubeKNNDistanceCoord 15 /* ~> */
58-
#define CubeKNNDistanceTaxicab 16 /* <#> */
59-
#define CubeKNNDistanceEuclid 17 /* <-> */
60-
#define CubeKNNDistanceChebyshev 18 /* <=> */
57+
#define CubeKNNDistanceCoord 15 /* ~> */
58+
#define CubeKNNDistanceTaxicab 16 /* <#> */
59+
#define CubeKNNDistanceEuclid 17 /* <-> */
60+
#define CubeKNNDistanceChebyshev 18 /* <=> */
6161

6262
/* in cubescan.l */
6363
extern int cube_yylex(void);

contrib/dblink/dblink.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ typedef struct remoteConn
6767
{
6868
PGconn *conn; /* Hold the remote connection */
6969
int openCursorCount; /* The number of open cursors */
70-
bool newXactForCursor; /* Opened a transaction for a cursor */
70+
bool newXactForCursor; /* Opened a transaction for a cursor */
7171
} remoteConn;
7272

7373
typedef struct storeInfo
@@ -1098,7 +1098,7 @@ storeQueryResult(volatile storeInfo *sinfo, PGconn *conn, const char *sql)
10981098
if (!PQsendQuery(conn, sql))
10991099
elog(ERROR, "could not send query: %s", pchomp(PQerrorMessage(conn)));
11001100

1101-
if (!PQsetSingleRowMode(conn)) /* shouldn't fail */
1101+
if (!PQsetSingleRowMode(conn)) /* shouldn't fail */
11021102
elog(ERROR, "failed to set single-row mode for dblink query");
11031103

11041104
for (;;)

contrib/file_fdw/file_fdw.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,13 +544,13 @@ fileGetForeignPaths(PlannerInfo *root,
544544
*/
545545
add_path(baserel, (Path *)
546546
create_foreignscan_path(root, baserel,
547-
NULL, /* default pathtarget */
547+
NULL, /* default pathtarget */
548548
baserel->rows,
549549
startup_cost,
550550
total_cost,
551-
NIL, /* no pathkeys */
552-
NULL, /* no outer rel either */
553-
NULL, /* no extra plan */
551+
NIL, /* no pathkeys */
552+
NULL, /* no outer rel either */
553+
NULL, /* no extra plan */
554554
coptions));
555555

556556
/*

contrib/fuzzystrmatch/dmetaphone.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ The remaining code is authored by Andrew Dunstan <[email protected]> and
111111
#include <string.h>
112112
#include <stdarg.h>
113113

114-
#endif /* DMETAPHONE_MAIN */
114+
#endif /* DMETAPHONE_MAIN */
115115

116116
#include <assert.h>
117117
#include <ctype.h>
@@ -197,7 +197,7 @@ dmetaphone_alt(PG_FUNCTION_ARGS)
197197
* in a case like this.
198198
*/
199199

200-
#define META_FREE(x) ((void)true) /* pfree((x)) */
200+
#define META_FREE(x) ((void)true) /* pfree((x)) */
201201
#else /* not defined DMETAPHONE_MAIN */
202202

203203
/* use the standard malloc library when not running in PostgreSQL */
@@ -209,7 +209,7 @@ dmetaphone_alt(PG_FUNCTION_ARGS)
209209
(v = (t*)realloc((v),((n)*sizeof(t))))
210210

211211
#define META_FREE(x) free((x))
212-
#endif /* defined DMETAPHONE_MAIN */
212+
#endif /* defined DMETAPHONE_MAIN */
213213

214214

215215

@@ -977,7 +977,7 @@ DoubleMetaphone(char *str, char **codes)
977977
}
978978
}
979979

980-
if (GetAt(original, current + 1) == 'J') /* it could happen! */
980+
if (GetAt(original, current + 1) == 'J') /* it could happen! */
981981
current += 2;
982982
else
983983
current += 1;

contrib/hstore/hstore.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ extern Pairs *hstoreArrayToPairs(ArrayType *a, int *npairs);
181181
#define HStoreExistsStrategyNumber 9
182182
#define HStoreExistsAnyStrategyNumber 10
183183
#define HStoreExistsAllStrategyNumber 11
184-
#define HStoreOldContainsStrategyNumber 13 /* backwards compatibility */
184+
#define HStoreOldContainsStrategyNumber 13 /* backwards compatibility */
185185

186186
/*
187187
* defining HSTORE_POLLUTE_NAMESPACE=0 will prevent use of old function names;
@@ -202,4 +202,4 @@ extern Pairs *hstoreArrayToPairs(ArrayType *a, int *npairs);
202202
extern int no_such_variable
203203
#endif
204204

205-
#endif /* __HSTORE_H__ */
205+
#endif /* __HSTORE_H__ */

0 commit comments

Comments
 (0)