Skip to content

Commit 0245f8d

Browse files
committed
Pre-beta mechanical code beautification.
Run pgindent, pgperltidy, and reformat-dat-files. This set of diffs is a bit larger than typical. We've updated to pg_bsd_indent 2.1.2, which properly indents variable declarations that have multi-line initialization expressions (the continuation lines are now indented one tab stop). We've also updated to perltidy version 20230309 and changed some of its settings, which reduces its desire to add whitespace to lines to make assignments etc. line up. Going forward, that should make for fewer random-seeming changes to existing code. Discussion: https://postgr.es/m/20230428092545.qfb3y5wcu4cm75ur@alvherre.pgsql
1 parent df6b19f commit 0245f8d

File tree

402 files changed

+4754
-4425
lines changed

Some content is hidden

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

402 files changed

+4754
-4425
lines changed

contrib/amcheck/t/001_verify_heapam.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ sub relation_filepath
8181
my ($relname) = @_;
8282

8383
my $pgdata = $node->data_dir;
84-
my $rel = $node->safe_psql('postgres',
84+
my $rel = $node->safe_psql('postgres',
8585
qq(SELECT pg_relation_filepath('$relname')));
8686
die "path not found for relation $relname" unless defined $rel;
8787
return "$pgdata/$rel";
@@ -267,7 +267,7 @@ sub check_all_options_uncorrupted
267267
for my $endblock (qw(NULL 0))
268268
{
269269
my $opts =
270-
"on_error_stop := $stop, "
270+
"on_error_stop := $stop, "
271271
. "check_toast := $check_toast, "
272272
. "skip := $skip, "
273273
. "startblock := $startblock, "

contrib/amcheck/t/003_cic_2pc.pl

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,38 +38,44 @@
3838

3939
my $main_h = $node->background_psql('postgres');
4040

41-
$main_h->query_safe(q(
41+
$main_h->query_safe(
42+
q(
4243
BEGIN;
4344
INSERT INTO tbl VALUES(0);
4445
));
4546

4647
my $cic_h = $node->background_psql('postgres');
4748

48-
$cic_h->query_until(qr/start/, q(
49+
$cic_h->query_until(
50+
qr/start/, q(
4951
\echo start
5052
CREATE INDEX CONCURRENTLY idx ON tbl(i);
5153
));
5254

53-
$main_h->query_safe(q(
55+
$main_h->query_safe(
56+
q(
5457
PREPARE TRANSACTION 'a';
5558
));
5659

57-
$main_h->query_safe(q(
60+
$main_h->query_safe(
61+
q(
5862
BEGIN;
5963
INSERT INTO tbl VALUES(0);
6064
));
6165

6266
$node->safe_psql('postgres', q(COMMIT PREPARED 'a';));
6367

64-
$main_h->query_safe(q(
68+
$main_h->query_safe(
69+
q(
6570
PREPARE TRANSACTION 'b';
6671
BEGIN;
6772
INSERT INTO tbl VALUES(0);
6873
));
6974

7075
$node->safe_psql('postgres', q(COMMIT PREPARED 'b';));
7176

72-
$main_h->query_safe(q(
77+
$main_h->query_safe(
78+
q(
7379
PREPARE TRANSACTION 'c';
7480
COMMIT PREPARED 'c';
7581
));
@@ -97,7 +103,8 @@
97103
$node->restart;
98104

99105
my $reindex_h = $node->background_psql('postgres');
100-
$reindex_h->query_until(qr/start/, q(
106+
$reindex_h->query_until(
107+
qr/start/, q(
101108
\echo start
102109
DROP INDEX CONCURRENTLY idx;
103110
CREATE INDEX CONCURRENTLY idx ON tbl(i);

contrib/amcheck/verify_heapam.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ verify_heapam(PG_FUNCTION_ARGS)
407407
OffsetNumber successor[MaxOffsetNumber];
408408
bool lp_valid[MaxOffsetNumber];
409409
bool xmin_commit_status_ok[MaxOffsetNumber];
410-
XidCommitStatus xmin_commit_status[MaxOffsetNumber];
410+
XidCommitStatus xmin_commit_status[MaxOffsetNumber];
411411

412412
CHECK_FOR_INTERRUPTS();
413413

@@ -444,7 +444,7 @@ verify_heapam(PG_FUNCTION_ARGS)
444444
for (ctx.offnum = FirstOffsetNumber; ctx.offnum <= maxoff;
445445
ctx.offnum = OffsetNumberNext(ctx.offnum))
446446
{
447-
BlockNumber nextblkno;
447+
BlockNumber nextblkno;
448448
OffsetNumber nextoffnum;
449449

450450
successor[ctx.offnum] = InvalidOffsetNumber;
@@ -484,9 +484,9 @@ verify_heapam(PG_FUNCTION_ARGS)
484484

485485
/*
486486
* Since we've checked that this redirect points to a line
487-
* pointer between FirstOffsetNumber and maxoff, it should
488-
* now be safe to fetch the referenced line pointer. We expect
489-
* it to be LP_NORMAL; if not, that's corruption.
487+
* pointer between FirstOffsetNumber and maxoff, it should now
488+
* be safe to fetch the referenced line pointer. We expect it
489+
* to be LP_NORMAL; if not, that's corruption.
490490
*/
491491
rditem = PageGetItemId(ctx.page, rdoffnum);
492492
if (!ItemIdIsUsed(rditem))
@@ -610,8 +610,8 @@ verify_heapam(PG_FUNCTION_ARGS)
610610
{
611611
/*
612612
* We should not have set successor[ctx.offnum] to a value
613-
* other than InvalidOffsetNumber unless that line pointer
614-
* is LP_NORMAL.
613+
* other than InvalidOffsetNumber unless that line pointer is
614+
* LP_NORMAL.
615615
*/
616616
Assert(ItemIdIsNormal(next_lp));
617617

@@ -642,8 +642,8 @@ verify_heapam(PG_FUNCTION_ARGS)
642642
}
643643

644644
/*
645-
* If the next line pointer is a redirect, or if it's a tuple
646-
* but the XMAX of this tuple doesn't match the XMIN of the next
645+
* If the next line pointer is a redirect, or if it's a tuple but
646+
* the XMAX of this tuple doesn't match the XMIN of the next
647647
* tuple, then the two aren't part of the same update chain and
648648
* there is nothing more to do.
649649
*/
@@ -667,8 +667,8 @@ verify_heapam(PG_FUNCTION_ARGS)
667667
}
668668

669669
/*
670-
* This tuple and the tuple to which it points seem to be part
671-
* of an update chain.
670+
* This tuple and the tuple to which it points seem to be part of
671+
* an update chain.
672672
*/
673673
predecessor[nextoffnum] = ctx.offnum;
674674

@@ -721,8 +721,8 @@ verify_heapam(PG_FUNCTION_ARGS)
721721
}
722722

723723
/*
724-
* If the current tuple's xmin is aborted but the successor tuple's
725-
* xmin is in-progress or committed, that's corruption.
724+
* If the current tuple's xmin is aborted but the successor
725+
* tuple's xmin is in-progress or committed, that's corruption.
726726
*/
727727
if (xmin_commit_status_ok[ctx.offnum] &&
728728
xmin_commit_status[ctx.offnum] == XID_ABORTED &&
@@ -1025,7 +1025,7 @@ check_tuple_visibility(HeapCheckContext *ctx, bool *xmin_commit_status_ok,
10251025
HeapTupleHeader tuphdr = ctx->tuphdr;
10261026

10271027
ctx->tuple_could_be_pruned = true; /* have not yet proven otherwise */
1028-
*xmin_commit_status_ok = false; /* have not yet proven otherwise */
1028+
*xmin_commit_status_ok = false; /* have not yet proven otherwise */
10291029

10301030
/* If xmin is normal, it should be within valid range */
10311031
xmin = HeapTupleHeaderGetXmin(tuphdr);
@@ -1837,7 +1837,7 @@ check_tuple(HeapCheckContext *ctx, bool *xmin_commit_status_ok,
18371837
* therefore cannot check it.
18381838
*/
18391839
if (!check_tuple_visibility(ctx, xmin_commit_status_ok,
1840-
xmin_commit_status))
1840+
xmin_commit_status))
18411841
return;
18421842

18431843
/*
@@ -1897,8 +1897,8 @@ FullTransactionIdFromXidAndCtx(TransactionId xid, const HeapCheckContext *ctx)
18971897
diff = (int32) (ctx->next_xid - xid);
18981898

18991899
/*
1900-
* In cases of corruption we might see a 32bit xid that is before epoch
1901-
* 0. We can't represent that as a 64bit xid, due to 64bit xids being
1900+
* In cases of corruption we might see a 32bit xid that is before epoch 0.
1901+
* We can't represent that as a 64bit xid, due to 64bit xids being
19021902
* unsigned integers, without the modulo arithmetic of 32bit xid. There's
19031903
* no really nice way to deal with that, but it works ok enough to use
19041904
* FirstNormalFullTransactionId in that case, as a freshly initdb'd

contrib/auto_explain/t/001_auto_explain.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ sub query_log
1919
local $ENV{PGOPTIONS} = join " ",
2020
map { "-c $_=$params->{$_}" } keys %$params;
2121

22-
my $log = $node->logfile();
22+
my $log = $node->logfile();
2323
my $offset = -s $log;
2424

2525
$node->safe_psql("postgres", $sql);
@@ -113,7 +113,7 @@ sub query_log
113113
"SELECT * FROM pg_class;",
114114
{
115115
"auto_explain.log_verbose" => "on",
116-
"compute_query_id" => "on"
116+
"compute_query_id" => "on"
117117
});
118118

119119
like(
@@ -127,7 +127,7 @@ sub query_log
127127
"SELECT * FROM pg_class;",
128128
{
129129
"auto_explain.log_verbose" => "on",
130-
"compute_query_id" => "regress"
130+
"compute_query_id" => "regress"
131131
});
132132

133133
unlike(

contrib/basebackup_to_shell/t/001_basic.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# This is only needed on Windows machines that don't use UNIX sockets.
2626
$node->init(
2727
'allows_streaming' => 1,
28-
'auth_extra' => [ '--create-role', 'backupuser' ]);
28+
'auth_extra' => [ '--create-role', 'backupuser' ]);
2929

3030
$node->append_conf('postgresql.conf',
3131
"shared_preload_libraries = 'basebackup_to_shell'");
@@ -50,7 +50,7 @@
5050
'fails if basebackup_to_shell.command is not set');
5151

5252
# Configure basebackup_to_shell.command and reload the configuration file.
53-
my $backup_path = PostgreSQL::Test::Utils::tempdir;
53+
my $backup_path = PostgreSQL::Test::Utils::tempdir;
5454
my $escaped_backup_path = $backup_path;
5555
$escaped_backup_path =~ s{\\}{\\\\}g
5656
if ($PostgreSQL::Test::Utils::windows_os);

contrib/basic_archive/basic_archive.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ basic_archive_shutdown(ArchiveModuleState *state)
407407
MemoryContext basic_archive_context;
408408

409409
/*
410-
* If we didn't get to storing the pointer to our allocated state, we don't
411-
* have anything to clean up.
410+
* If we didn't get to storing the pointer to our allocated state, we
411+
* don't have anything to clean up.
412412
*/
413413
if (data == NULL)
414414
return;

contrib/dblink/dblink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ dblink_get_connections(PG_FUNCTION_ARGS)
12871287

12881288
if (astate)
12891289
PG_RETURN_DATUM(makeArrayResult(astate,
1290-
CurrentMemoryContext));
1290+
CurrentMemoryContext));
12911291
else
12921292
PG_RETURN_NULL();
12931293
}

contrib/intarray/bench/bench.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
$outf = ($opt{u}) ? 'distinct( message.mid )' : 'message.mid';
8484
}
8585
my $sql =
86-
"select $outf from "
86+
"select $outf from "
8787
. join(', ', keys %table)
8888
. " where "
8989
. join(' AND ', @where) . ';';
@@ -100,9 +100,9 @@
100100
print @plan;
101101
}
102102

103-
my $t0 = [gettimeofday];
103+
my $t0 = [gettimeofday];
104104
my $count = 0;
105-
my $b = $opt{b};
105+
my $b = $opt{b};
106106
$b ||= 1;
107107
my @a;
108108
foreach (1 .. $b)

contrib/intarray/bench/create_test.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
2020
EOT
2121

22-
open(my $msg, '>', "message.tmp") || die;
22+
open(my $msg, '>', "message.tmp") || die;
2323
open(my $map, '>', "message_section_map.tmp") || die;
2424

2525
srand(1);

contrib/ltree/ltree_gist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ltree_gist_alloc(bool isalltrue, BITVECP sign, int siglen,
4343
ltree *left, ltree *right)
4444
{
4545
int32 size = LTG_HDRSIZE + (isalltrue ? 0 : siglen) +
46-
(left ? VARSIZE(left) + (right ? VARSIZE(right) : 0) : 0);
46+
(left ? VARSIZE(left) + (right ? VARSIZE(right) : 0) : 0);
4747
ltree_gist *result = palloc(size);
4848

4949
SET_VARSIZE(result, size);

contrib/ltree/ltree_io.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ Datum
175175
ltree_in(PG_FUNCTION_ARGS)
176176
{
177177
char *buf = (char *) PG_GETARG_POINTER(0);
178-
ltree *res;
178+
ltree *res;
179179

180180
if ((res = parse_ltree(buf, fcinfo->context)) == NULL)
181181
PG_RETURN_NULL();
@@ -584,7 +584,7 @@ parse_lquery(const char *buf, struct Node *escontext)
584584
*/
585585
static bool
586586
finish_nodeitem(nodeitem *lptr, const char *ptr, bool is_lquery, int pos,
587-
struct Node *escontext)
587+
struct Node *escontext)
588588
{
589589
if (is_lquery)
590590
{
@@ -745,7 +745,7 @@ Datum
745745
lquery_in(PG_FUNCTION_ARGS)
746746
{
747747
char *buf = (char *) PG_GETARG_POINTER(0);
748-
lquery *res;
748+
lquery *res;
749749

750750
if ((res = parse_lquery(buf, fcinfo->context)) == NULL)
751751
PG_RETURN_NULL();

contrib/ltree/ltxtquery_io.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ pushval_asis(QPRS_STATE *state, int type, char *strval, int lenval, uint16 flag)
186186
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
187187
errmsg("word is too long")));
188188

189-
if (! pushquery(state, type, ltree_crc32_sz(strval, lenval),
190-
state->curop - state->op, lenval, flag))
189+
if (!pushquery(state, type, ltree_crc32_sz(strval, lenval),
190+
state->curop - state->op, lenval, flag))
191191
return false;
192192

193193
while (state->curop - state->op + lenval + 1 >= state->lenop)
@@ -408,7 +408,7 @@ PG_FUNCTION_INFO_V1(ltxtq_in);
408408
Datum
409409
ltxtq_in(PG_FUNCTION_ARGS)
410410
{
411-
ltxtquery *res;
411+
ltxtquery *res;
412412

413413
if ((res = queryin((char *) PG_GETARG_POINTER(0), fcinfo->context)) == NULL)
414414
PG_RETURN_NULL();

contrib/pg_prewarm/t/001_basic.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
# setup
2323
$node->safe_psql("postgres",
24-
"CREATE EXTENSION pg_prewarm;\n"
24+
"CREATE EXTENSION pg_prewarm;\n"
2525
. "CREATE TABLE test(c1 int);\n"
2626
. "INSERT INTO test SELECT generate_series(1, 100);");
2727

contrib/pg_walinspect/pg_walinspect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ GetWALBlockInfo(FunctionCallInfo fcinfo, XLogReaderState *record,
252252
int block_id;
253253
ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
254254
RmgrData desc;
255-
const char *record_type;
256-
StringInfoData rec_desc;
255+
const char *record_type;
256+
StringInfoData rec_desc;
257257

258258
Assert(XLogRecHasAnyBlockRefs(record));
259259

contrib/postgres_fdw/connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ typedef struct ConnCacheEntry
6161
bool have_error; /* have any subxacts aborted in this xact? */
6262
bool changing_xact_state; /* xact state change in process */
6363
bool parallel_commit; /* do we commit (sub)xacts in parallel? */
64-
bool parallel_abort; /* do we abort (sub)xacts in parallel? */
64+
bool parallel_abort; /* do we abort (sub)xacts in parallel? */
6565
bool invalidated; /* true if reconnect is pending */
6666
bool keep_connections; /* setting value of keep_connections
6767
* server option */

0 commit comments

Comments
 (0)