From 4632e5cf4bc5c496f41dfc6a89533e7afa7262dd Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sun, 15 Sep 2024 21:25:00 -0400 Subject: [PATCH] Perl scripts: revert 43ce181059d Small improvement not worth the code churn. Reported-by: Andrew Dunstan Discussion: https://postgr.es/m/42f2242a-422b-4aa3-8d60-d67b229c4a52@dunslane.net Backpatch-through: master --- src/tools/copyright.pl | 2 +- src/tools/gen_export.pl | 10 +++++----- src/tools/gen_keywordlist.pl | 4 ++-- src/tools/msvc_gendef.pl | 10 +++++----- src/tools/version_stamp.pl | 18 +++++++++--------- src/tools/win32tzlist.pl | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/tools/copyright.pl b/src/tools/copyright.pl index 5dd63b2ce16..804537f26a4 100755 --- a/src/tools/copyright.pl +++ b/src/tools/copyright.pl @@ -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 diff --git a/src/tools/gen_export.pl b/src/tools/gen_export.pl index eca43fa1f23..d9fdaaaf6d0 100644 --- a/src/tools/gen_export.pl +++ b/src/tools/gen_export.pl @@ -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: *; }; -'; +"; } diff --git a/src/tools/gen_keywordlist.pl b/src/tools/gen_keywordlist.pl index 22e65f31978..1b3bc2e9b47 100644 --- a/src/tools/gen_keywordlist.pl +++ b/src/tools/gen_keywordlist.pl @@ -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; diff --git a/src/tools/msvc_gendef.pl b/src/tools/msvc_gendef.pl index 9c115c1ca56..97346cc8929 100644 --- a/src/tools/msvc_gendef.pl +++ b/src/tools/msvc_gendef.pl @@ -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"; diff --git a/src/tools/version_stamp.pl b/src/tools/version_stamp.pl index 1b15d73a865..3743ece2996 100755 --- a/src/tools/version_stamp.pl +++ b/src/tools/version_stamp.pl @@ -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: $?"; diff --git a/src/tools/win32tzlist.pl b/src/tools/win32tzlist.pl index e0896e934af..17d45b95705 100755 --- a/src/tools/win32tzlist.pl +++ b/src/tools/win32tzlist.pl @@ -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;