Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e3860ff

Browse files
committed
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
1 parent 8ff6d4e commit e3860ff

File tree

379 files changed

+1726
-1708
lines changed

Some content is hidden

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

379 files changed

+1726
-1708
lines changed

contrib/bloom/blutils.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ _PG_init(void)
7575
bl_relopt_tab[i + 1].optname = MemoryContextStrdup(TopMemoryContext,
7676
buf);
7777
bl_relopt_tab[i + 1].opttype = RELOPT_TYPE_INT;
78-
bl_relopt_tab[i + 1].offset = offsetof(BloomOptions, bitSize[0]) +sizeof(int) * i;
78+
bl_relopt_tab[i + 1].offset = offsetof(BloomOptions, bitSize[0]) + sizeof(int) * i;
7979
}
8080
}
8181

contrib/btree_gist/btree_utils_var.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ gbt_var_key_readable(const GBT_VARKEY *k)
7272
* Create a leaf-entry to store in the index, from a single Datum.
7373
*/
7474
static GBT_VARKEY *
75-
gbt_var_key_from_datum(const struct varlena * u)
75+
gbt_var_key_from_datum(const struct varlena *u)
7676
{
7777
int32 lowersize = VARSIZE(u);
7878
GBT_VARKEY *r;

contrib/dblink/dblink.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ dblink_conn_not_avail(const char *conname)
179179

180180
static void
181181
dblink_get_conn(char *conname_or_str,
182-
PGconn *volatile * conn_p, char **conname_p, volatile bool *freeconn_p)
182+
PGconn *volatile *conn_p, char **conname_p, volatile bool *freeconn_p)
183183
{
184184
remoteConn *rconn = getConnectionByName(conname_or_str);
185185
PGconn *conn;
@@ -723,7 +723,7 @@ dblink_record_internal(FunctionCallInfo fcinfo, bool is_async)
723723
/* shouldn't happen */
724724
elog(ERROR, "wrong number of arguments");
725725
}
726-
else /* is_async */
726+
else /* is_async */
727727
{
728728
/* get async result */
729729
conname = text_to_cstring(PG_GETARG_TEXT_PP(0));

contrib/fuzzystrmatch/fuzzystrmatch.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ _metaphone(char *word, /* IN */
389389
/*-- Allocate memory for our phoned_phrase --*/
390390
if (max_phonemes == 0)
391391
{ /* Assume largest possible */
392-
*phoned_word = palloc(sizeof(char) * strlen(word) +1);
392+
*phoned_word = palloc(sizeof(char) * strlen(word) + 1);
393393
}
394394
else
395395
{
@@ -722,7 +722,7 @@ _metaphone(char *word, /* IN */
722722
End_Phoned_Word;
723723

724724
return (META_SUCCESS);
725-
} /* END metaphone */
725+
} /* END metaphone */
726726

727727

728728
/*

contrib/intarray/_int_gin.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ ginint4_queryextract(PG_FUNCTION_ARGS)
9393
case RTOldContainsStrategyNumber:
9494
if (*nentries > 0)
9595
*searchMode = GIN_SEARCH_MODE_DEFAULT;
96-
else /* everything contains the empty set */
96+
else /* everything contains the empty set */
9797
*searchMode = GIN_SEARCH_MODE_ALL;
9898
break;
9999
default:

contrib/ltree/lquery_op.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static struct
147147
{
148148
bool muse;
149149
uint32 high_pos;
150-
} SomeStack =
150+
} SomeStack =
151151

152152
{
153153
false, 0,

contrib/oid2name/oid2name.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void sql_exec_dumpalltbspc(PGconn *, struct options *);
5757

5858
/* function to parse command line options and check for some usage errors. */
5959
void
60-
get_opts(int argc, char **argv, struct options * my_opts)
60+
get_opts(int argc, char **argv, struct options *my_opts)
6161
{
6262
int c;
6363
const char *progname;
@@ -260,7 +260,7 @@ get_comma_elts(eary *eary)
260260

261261
/* establish connection with database. */
262262
PGconn *
263-
sql_conn(struct options * my_opts)
263+
sql_conn(struct options *my_opts)
264264
{
265265
PGconn *conn;
266266
bool have_password = false;
@@ -411,7 +411,7 @@ sql_exec(PGconn *conn, const char *todo, bool quiet)
411411
* Dump all databases. There are no system objects to worry about.
412412
*/
413413
void
414-
sql_exec_dumpalldbs(PGconn *conn, struct options * opts)
414+
sql_exec_dumpalldbs(PGconn *conn, struct options *opts)
415415
{
416416
char todo[1024];
417417

@@ -428,7 +428,7 @@ sql_exec_dumpalldbs(PGconn *conn, struct options * opts)
428428
* Dump all tables, indexes and sequences in the current database.
429429
*/
430430
void
431-
sql_exec_dumpalltables(PGconn *conn, struct options * opts)
431+
sql_exec_dumpalltables(PGconn *conn, struct options *opts)
432432
{
433433
char todo[1024];
434434
char *addfields = ",c.oid AS \"Oid\", nspname AS \"Schema\", spcname as \"Tablespace\" ";
@@ -460,7 +460,7 @@ sql_exec_dumpalltables(PGconn *conn, struct options * opts)
460460
* given objects in the current database.
461461
*/
462462
void
463-
sql_exec_searchtables(PGconn *conn, struct options * opts)
463+
sql_exec_searchtables(PGconn *conn, struct options *opts)
464464
{
465465
char *todo;
466466
char *qualifiers,
@@ -516,7 +516,7 @@ sql_exec_searchtables(PGconn *conn, struct options * opts)
516516
CppAsString2(RELKIND_SEQUENCE) ","
517517
CppAsString2(RELKIND_TOASTVALUE) ") AND\n"
518518
" t.oid = CASE\n"
519-
" WHEN reltablespace <> 0 THEN reltablespace\n"
519+
" WHEN reltablespace <> 0 THEN reltablespace\n"
520520
" ELSE dattablespace\n"
521521
" END AND\n"
522522
" (%s)\n"
@@ -530,7 +530,7 @@ sql_exec_searchtables(PGconn *conn, struct options * opts)
530530
}
531531

532532
void
533-
sql_exec_dumpalltbspc(PGconn *conn, struct options * opts)
533+
sql_exec_dumpalltbspc(PGconn *conn, struct options *opts)
534534
{
535535
char todo[1024];
536536

contrib/pg_stat_statements/pg_stat_statements.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ typedef enum
250250
PGSS_TRACK_NONE, /* track no statements */
251251
PGSS_TRACK_TOP, /* only top level statements */
252252
PGSS_TRACK_ALL /* all statements, including nested ones */
253-
} PGSSTrackLevel;
253+
} PGSSTrackLevel;
254254

255255
static const struct config_enum_entry track_options[] =
256256
{

contrib/pg_trgm/trgm_op.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ generate_trgm(char *str, int slen)
325325

326326
protect_out_of_mem(slen);
327327

328-
trg = (TRGM *) palloc(TRGMHDRSIZE + sizeof(trgm) * (slen / 2 + 1) *3);
328+
trg = (TRGM *) palloc(TRGMHDRSIZE + sizeof(trgm) * (slen / 2 + 1) * 3);
329329
trg->flag = ARRKEY;
330330

331331
len = generate_trgm_only(GETARR(trg), str, slen);
@@ -572,8 +572,8 @@ calc_word_similarity(char *str1, int slen1, char *str2, int slen2,
572572
protect_out_of_mem(slen1 + slen2);
573573

574574
/* Make positional trigrams */
575-
trg1 = (trgm *) palloc(sizeof(trgm) * (slen1 / 2 + 1) *3);
576-
trg2 = (trgm *) palloc(sizeof(trgm) * (slen2 / 2 + 1) *3);
575+
trg1 = (trgm *) palloc(sizeof(trgm) * (slen1 / 2 + 1) * 3);
576+
trg2 = (trgm *) palloc(sizeof(trgm) * (slen2 / 2 + 1) * 3);
577577

578578
len1 = generate_trgm_only(trg1, str1, slen1);
579579
len2 = generate_trgm_only(trg2, str2, slen2);
@@ -806,7 +806,7 @@ generate_wildcard_trgm(const char *str, int slen)
806806

807807
protect_out_of_mem(slen);
808808

809-
trg = (TRGM *) palloc(TRGMHDRSIZE + sizeof(trgm) * (slen / 2 + 1) *3);
809+
trg = (TRGM *) palloc(TRGMHDRSIZE + sizeof(trgm) * (slen / 2 + 1) * 3);
810810
trg->flag = ARRKEY;
811811
SET_VARSIZE(trg, TRGMHDRSIZE);
812812

contrib/pg_visibility/pg_visibility.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ collect_visibility_data(Oid relid, bool include_pd)
481481
check_relation_relkind(rel);
482482

483483
nblocks = RelationGetNumberOfBlocks(rel);
484-
info = palloc0(offsetof(vbits, bits) +nblocks);
484+
info = palloc0(offsetof(vbits, bits) + nblocks);
485485
info->next = 0;
486486
info->count = nblocks;
487487

contrib/pgcrypto/imath.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ mp_int_sqr(mp_int a, mp_int c)
908908
CHECK(a != NULL && c != NULL);
909909

910910
/* Get a temporary buffer big enough to hold the result */
911-
osize = (mp_size) 4 *((MP_USED(a) + 1) / 2);
911+
osize = (mp_size) 4 * ((MP_USED(a) + 1) / 2);
912912

913913
if (a == c)
914914
{
@@ -1613,8 +1613,8 @@ mp_int_gcd(mp_int a, mp_int b, mp_int c)
16131613

16141614
CLEANUP:
16151615
mp_int_clear(&v);
1616-
V: mp_int_clear(&u);
1617-
U: mp_int_clear(&t);
1616+
V: mp_int_clear(&u);
1617+
U: mp_int_clear(&t);
16181618

16191619
return res;
16201620
}
@@ -3512,7 +3512,7 @@ s_outlen(mp_int z, mp_size r)
35123512
double raw;
35133513

35143514
bits = mp_int_count_bits(z);
3515-
raw = (double) bits *s_log2[r];
3515+
raw = (double) bits * s_log2[r];
35163516

35173517
return (int) (raw + 0.999999);
35183518
}

contrib/pgcrypto/imath.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ typedef struct mpz
6161
mp_size used;
6262
mp_sign sign;
6363
} mpz_t ,
64+
6465
*mp_int;
6566

6667
#define MP_DIGITS(Z) ((Z)->digits)
@@ -117,9 +118,9 @@ mp_result mp_int_mul_value(mp_int a, int value, mp_int c);
117118
mp_result mp_int_mul_pow2(mp_int a, int p2, mp_int c);
118119
mp_result mp_int_sqr(mp_int a, mp_int c); /* c = a * a */
119120

120-
mp_result mp_int_div(mp_int a, mp_int b, /* q = a / b */
121+
mp_result mp_int_div(mp_int a, mp_int b, /* q = a / b */
121122
mp_int q, mp_int r); /* r = a % b */
122-
mp_result mp_int_div_value(mp_int a, int value, /* q = a / value */
123+
mp_result mp_int_div_value(mp_int a, int value, /* q = a / value */
123124
mp_int q, int *r); /* r = a % value */
124125
mp_result mp_int_div_pow2(mp_int a, int p2, /* q = a / 2^p2 */
125126
mp_int q, mp_int r); /* r = q % 2^p2 */

contrib/pgcrypto/internal.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ rj_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv)
318318
}
319319

320320
static int
321-
rj_real_init(struct int_ctx * cx, int dir)
321+
rj_real_init(struct int_ctx *cx, int dir)
322322
{
323323
aes_set_key(&cx->ctx.rj, cx->keybuf, cx->keylen * 8, dir);
324324
return 0;

contrib/pgcrypto/mbuf.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct PushFilterOps
5151
* copied (in-place) returns 0 on error
5252
*/
5353
int (*push) (PushFilter *next, void *priv,
54-
const uint8 *src, int len);
54+
const uint8 *src, int len);
5555
int (*flush) (PushFilter *next, void *priv);
5656
void (*free) (void *priv);
5757
};
@@ -69,7 +69,7 @@ struct PullFilterOps
6969
* use buf as work area if NULL in-place copy
7070
*/
7171
int (*pull) (void *priv, PullFilter *src, int len,
72-
uint8 **data_p, uint8 *buf, int buflen);
72+
uint8 **data_p, uint8 *buf, int buflen);
7373
void (*free) (void *priv);
7474
};
7575

contrib/pgcrypto/pgp-decrypt.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ mdcbuf_init(void **priv_p, void *arg, PullFilter *src)
460460
}
461461

462462
static int
463-
mdcbuf_finish(struct MDCBufData * st)
463+
mdcbuf_finish(struct MDCBufData *st)
464464
{
465465
uint8 hash[20];
466466
int res;
@@ -485,7 +485,7 @@ mdcbuf_finish(struct MDCBufData * st)
485485
}
486486

487487
static void
488-
mdcbuf_load_data(struct MDCBufData * st, uint8 *src, int len)
488+
mdcbuf_load_data(struct MDCBufData *st, uint8 *src, int len)
489489
{
490490
uint8 *dst = st->pos + st->avail;
491491

@@ -495,14 +495,14 @@ mdcbuf_load_data(struct MDCBufData * st, uint8 *src, int len)
495495
}
496496

497497
static void
498-
mdcbuf_load_mdc(struct MDCBufData * st, uint8 *src, int len)
498+
mdcbuf_load_mdc(struct MDCBufData *st, uint8 *src, int len)
499499
{
500500
memmove(st->mdc_buf + st->mdc_avail, src, len);
501501
st->mdc_avail += len;
502502
}
503503

504504
static int
505-
mdcbuf_refill(struct MDCBufData * st, PullFilter *src)
505+
mdcbuf_refill(struct MDCBufData *st, PullFilter *src)
506506
{
507507
uint8 *data;
508508
int res;

contrib/pgcrypto/pgp-pgsql.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ struct debug_expect
132132
};
133133

134134
static void
135-
fill_expect(struct debug_expect * ex, int text_mode)
135+
fill_expect(struct debug_expect *ex, int text_mode)
136136
{
137137
ex->debug = 0;
138138
ex->expect = 0;
@@ -157,7 +157,7 @@ fill_expect(struct debug_expect * ex, int text_mode)
157157
} while (0)
158158

159159
static void
160-
check_expect(PGP_Context *ctx, struct debug_expect * ex)
160+
check_expect(PGP_Context *ctx, struct debug_expect *ex)
161161
{
162162
EX_CHECK(cipher_algo);
163163
EX_CHECK(s2k_mode);
@@ -179,7 +179,7 @@ show_debug(const char *msg)
179179

180180
static int
181181
set_arg(PGP_Context *ctx, char *key, char *val,
182-
struct debug_expect * ex)
182+
struct debug_expect *ex)
183183
{
184184
int res = 0;
185185

@@ -317,7 +317,7 @@ downcase_convert(const uint8 *s, int len)
317317

318318
static int
319319
parse_args(PGP_Context *ctx, uint8 *args, int arg_len,
320-
struct debug_expect * ex)
320+
struct debug_expect *ex)
321321
{
322322
char *str = downcase_convert(args, arg_len);
323323
char *key,
@@ -362,7 +362,7 @@ create_mbuf_from_vardata(text *data)
362362

363363
static void
364364
init_work(PGP_Context **ctx_p, int is_text,
365-
text *args, struct debug_expect * ex)
365+
text *args, struct debug_expect *ex)
366366
{
367367
int err = pgp_init(ctx_p);
368368

contrib/pgcrypto/px-crypt.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ struct px_crypt_algo
7474
char *id;
7575
unsigned id_len;
7676
char *(*crypt) (const char *psw, const char *salt,
77-
char *buf, unsigned len);
77+
char *buf, unsigned len);
7878
};
7979

8080
static const struct px_crypt_algo
@@ -115,7 +115,7 @@ struct generator
115115
{
116116
char *name;
117117
char *(*gen) (unsigned long count, const char *input, int size,
118-
char *output, int output_size);
118+
char *output, int output_size);
119119
int input_len;
120120
int def_rounds;
121121
int min_rounds;

contrib/pgcrypto/px.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ struct px_cipher
169169
struct px_combo
170170
{
171171
int (*init) (PX_Combo *cx, const uint8 *key, unsigned klen,
172-
const uint8 *iv, unsigned ivlen);
172+
const uint8 *iv, unsigned ivlen);
173173
int (*encrypt) (PX_Combo *cx, const uint8 *data, unsigned dlen,
174-
uint8 *res, unsigned *rlen);
174+
uint8 *res, unsigned *rlen);
175175
int (*decrypt) (PX_Combo *cx, const uint8 *data, unsigned dlen,
176-
uint8 *res, unsigned *rlen);
176+
uint8 *res, unsigned *rlen);
177177
unsigned (*encrypt_len) (PX_Combo *cx, unsigned dlen);
178178
unsigned (*decrypt_len) (PX_Combo *cx, unsigned dlen);
179179
void (*free) (PX_Combo *cx);

contrib/pgcrypto/rijndael.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ typedef struct _rijndael_ctx
4444
/* These are all based on 32 bit unsigned values and will therefore */
4545
/* require endian conversions for big-endian architectures */
4646

47-
rijndael_ctx *
48-
rijndael_set_key(rijndael_ctx *, const u4byte *, const u4byte, int);
47+
rijndael_ctx *rijndael_set_key(rijndael_ctx *, const u4byte *, const u4byte, int);
4948
void rijndael_encrypt(rijndael_ctx *, const u4byte *, u4byte *);
5049
void rijndael_decrypt(rijndael_ctx *, const u4byte *, u4byte *);
5150

0 commit comments

Comments
 (0)