mirror of
https://github.com/postgres/postgres.git
synced 2025-11-28 11:44:57 +03:00
Clean up Perl code according to perlcritic
Fix all perlcritic warnings of severity level 5, except in src/backend/utils/Gen_dummy_probes.pl, which is automatically generated. Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
This commit is contained in:
@@ -9,21 +9,21 @@ use strict;
|
||||
my $lastlockidx = -1;
|
||||
my $continue = "\n";
|
||||
|
||||
open my $lwlocknames, $ARGV[0] or die;
|
||||
open my $lwlocknames, '<', $ARGV[0] or die;
|
||||
|
||||
# Include PID in suffix in case parallel make runs this multiple times.
|
||||
my $htmp = "lwlocknames.h.tmp$$";
|
||||
my $ctmp = "lwlocknames.c.tmp$$";
|
||||
open H, '>', $htmp or die "Could not open $htmp: $!";
|
||||
open C, '>', $ctmp or die "Could not open $ctmp: $!";
|
||||
open my $h, '>', $htmp or die "Could not open $htmp: $!";
|
||||
open my $c, '>', $ctmp or die "Could not open $ctmp: $!";
|
||||
|
||||
my $autogen =
|
||||
"/* autogenerated from src/backend/storage/lmgr/lwlocknames.txt, do not edit */\n";
|
||||
print H $autogen;
|
||||
print H "/* there is deliberately not an #ifndef LWLOCKNAMES_H here */\n\n";
|
||||
print C $autogen, "\n";
|
||||
print $h $autogen;
|
||||
print $h "/* there is deliberately not an #ifndef LWLOCKNAMES_H here */\n\n";
|
||||
print $c $autogen, "\n";
|
||||
|
||||
print C "char *MainLWLockNames[] = {";
|
||||
print $c "char *MainLWLockNames[] = {";
|
||||
|
||||
while (<$lwlocknames>)
|
||||
{
|
||||
@@ -44,22 +44,22 @@ while (<$lwlocknames>)
|
||||
while ($lastlockidx < $lockidx - 1)
|
||||
{
|
||||
++$lastlockidx;
|
||||
printf C "%s \"<unassigned:%d>\"", $continue, $lastlockidx;
|
||||
printf $c "%s \"<unassigned:%d>\"", $continue, $lastlockidx;
|
||||
$continue = ",\n";
|
||||
}
|
||||
printf C "%s \"%s\"", $continue, $lockname;
|
||||
printf $c "%s \"%s\"", $continue, $lockname;
|
||||
$lastlockidx = $lockidx;
|
||||
$continue = ",\n";
|
||||
|
||||
print H "#define $lockname (&MainLWLockArray[$lockidx].lock)\n";
|
||||
print $h "#define $lockname (&MainLWLockArray[$lockidx].lock)\n";
|
||||
}
|
||||
|
||||
printf C "\n};\n";
|
||||
print H "\n";
|
||||
printf H "#define NUM_INDIVIDUAL_LWLOCKS %s\n", $lastlockidx + 1;
|
||||
printf $c "\n};\n";
|
||||
print $h "\n";
|
||||
printf $h "#define NUM_INDIVIDUAL_LWLOCKS %s\n", $lastlockidx + 1;
|
||||
|
||||
close H;
|
||||
close C;
|
||||
close $h;
|
||||
close $c;
|
||||
|
||||
rename($htmp, 'lwlocknames.h') || die "rename: $htmp: $!";
|
||||
rename($ctmp, 'lwlocknames.c') || die "rename: $ctmp: $!";
|
||||
|
||||
Reference in New Issue
Block a user