Perl scripts: eliminate "Useless interpolation" warnings

Eliminate warnings of Perl Critic from src/tools.

Backpatch-through: master
This commit is contained in:
Bruce Momjian 2024-09-15 10:55:37 -04:00
parent b8ea0f675f
commit 43ce181059
6 changed files with 23 additions and 23 deletions

View File

@ -44,7 +44,7 @@ sub wanted
return if ($_ =~ m/\.(ico|bin|po|key)$/);
my @lines;
tie @lines, "Tie::File", $File::Find::name;
tie @lines, 'Tie::File', $File::Find::name;
# We process all lines because some files have copyright
# strings embedded in them, e.g. src/bin/psql/help.c

View File

@ -14,7 +14,7 @@ GetOptions(
'format:s' => \$format,
'libname:s' => \$libname,
'input:s' => \$input,
'output:s' => \$output) or die "wrong arguments";
'output:s' => \$output) or die 'wrong arguments';
if (not( $format eq 'darwin'
or $format eq 'gnu'
@ -32,9 +32,9 @@ open(my $output_handle, '>', $output)
if ($format eq 'gnu')
{
print $output_handle "{
print $output_handle '{
global:
";
';
}
elsif ($format eq 'win')
{
@ -76,7 +76,7 @@ while (<$input_handle>)
if ($format eq 'gnu')
{
print $output_handle " local: *;
print $output_handle ' local: *;
};
";
';
}

View File

@ -160,7 +160,7 @@ printf $kwdef "#define %s_NUM_KEYWORDS %d\n\n", uc $varname, scalar @keywords;
# Emit the definition of the hash function.
my $funcname = $varname . "_hash_func";
my $funcname = $varname . '_hash_func';
my $f = PerfectHash::generate_hash_function(\@keywords, $funcname,
case_fold => $case_fold);
@ -169,7 +169,7 @@ printf $kwdef qq|static %s\n|, $f;
# Emit the struct that wraps all this lookup info into one variable.
printf $kwdef "static " if !$extern;
printf $kwdef 'static ' if !$extern;
printf $kwdef "const ScanKeywordList %s = {\n", $varname;
printf $kwdef qq|\t%s_kw_string,\n|, $varname;
printf $kwdef qq|\t%s_kw_offsets,\n|, $varname;

View File

@ -72,10 +72,10 @@ sub extract_syms
next unless $pieces[6];
# Skip externs used from another compilation unit
next if ($pieces[2] eq "UNDEF");
next if ($pieces[2] eq 'UNDEF');
# Skip static symbols
next unless ($pieces[4] eq "External");
next unless ($pieces[4] eq 'External');
# Skip some more MSVC-generated crud
next if $pieces[6] =~ /^@/;
@ -120,7 +120,7 @@ sub writedef
# Strip the leading underscore for win32, but not x64
$f =~ s/^_//
unless ($arch eq "x86_64");
unless ($arch eq 'x86_64');
# Emit just the name if it's a function symbol, or emit the name
# decorated with the DATA option for variables.
@ -193,11 +193,11 @@ mkdir($tempdir) unless -d $tempdir;
my $cmd = "dumpbin /nologo /symbols /out:$tmpfile " . join(' ', @files);
system($cmd) == 0 or die "Could not call dumpbin";
system($cmd) == 0 or die 'Could not call dumpbin';
rename($tmpfile, $symfile) or die $!;
extract_syms($symfile, \%def);
print "\n";
writedef($deffile, $arch, \%def);
print "Generated " . scalar(keys(%def)) . " symbols\n";
print 'Generated ' . scalar(keys(%def)) . " symbols\n";

View File

@ -37,7 +37,7 @@ if ($minor =~ m/^\d+$/)
{
$dotneeded = 1;
}
elsif ($minor eq "devel")
elsif ($minor eq 'devel')
{
$dotneeded = 0;
}
@ -63,7 +63,7 @@ my $fullversion;
# Create various required forms of the version number
if ($dotneeded)
{
$fullversion = $majorversion . "." . $minor;
$fullversion = $majorversion . '.' . $minor;
}
else
{
@ -73,8 +73,8 @@ else
# Get the autoconf version number for eventual nag message
# (this also ensures we're in the right directory)
my $aconfver = "";
open(my $fh, '<', "configure.ac") || die "could not read configure.ac: $!\n";
my $aconfver = '';
open(my $fh, '<', 'configure.ac') || die "could not read configure.ac: $!\n";
while (<$fh>)
{
if (m/^m4_if\(m4_defn\(\[m4_PACKAGE_VERSION\]\), \[(.*)\], \[\], \[m4_fatal/
@ -85,17 +85,17 @@ while (<$fh>)
}
}
close($fh);
$aconfver ne ""
$aconfver ne ''
|| die "could not find autoconf version number in configure.ac\n";
# Update configure.ac and other files that contain version numbers
my $fixedfiles = "";
my $fixedfiles = '';
sed_file("configure.ac",
sed_file('configure.ac',
"-e 's/AC_INIT(\\[PostgreSQL\\], \\[[0-9a-z.]*\\]/AC_INIT([PostgreSQL], [$fullversion]/'"
);
sed_file("meson.build",
sed_file('meson.build',
qq{-e "/^project(/,/^)/ s/ version: '[0-9a-z.]*',/ version: '$fullversion',/"}
);
@ -107,7 +107,7 @@ exit 0;
sub sed_file
{
my ($filename, $sedargs) = @_;
my ($tmpfilename) = $filename . ".tmp";
my ($tmpfilename) = $filename . '.tmp';
system("sed $sedargs $filename >$tmpfilename") == 0
or die "sed failed: $?";

View File

@ -38,7 +38,7 @@ my $tzfile = 'src/bin/initdb/findtimezone.c';
#
my $basekey;
$HKEY_LOCAL_MACHINE->Open(
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones", $basekey)
'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones', $basekey)
or die $!;
my @subkeys;