Perl scripts: revert 43ce181059d
authorBruce Momjian <[email protected]>
Mon, 16 Sep 2024 01:25:00 +0000 (21:25 -0400)
committerBruce Momjian <[email protected]>
Mon, 16 Sep 2024 01:25:24 +0000 (21:25 -0400)
Small improvement not worth the code churn.

Reported-by: Andrew Dunstan
Discussion: https://postgr.es/m/42f2242a-422b-4aa3-8d60-d67b229c4a52@dunslane.net

Back-through: master

src/tools/copyright.pl
src/tools/gen_export.pl
src/tools/gen_keywordlist.pl
src/tools/msvc_gendef.pl
src/tools/version_stamp.pl
src/tools/win32tzlist.pl

index 5dd63b2ce1652c587d52802f5691074a1bd74fb5..804537f26a4ea600631aea61a75a209a4f3ea8f4 100755 (executable)
@@ -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
index eca43fa1f2337a05653d96bc57f06ef6d508bac0..d9fdaaaf6d0f59a9205ff0d21280a5948f1bfa81 100644 (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: *;
 };
-';
+";
 }
index 22e65f319781bb068d1126ef10cffcc83cbbe411..1b3bc2e9b47e95b002e0a253ed3163f5585989e5 100644 (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;
index 9c115c1ca56f43f004f9fb7396938ab4d9ea2590..97346cc8929bf3fe5878126cde6b1f92f4959228 100644 (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";
index 1b15d73a865d245153b398e0b05c75df72f1a67f..3743ece29963381ef0125902fddb63ab6dfcb0c3 100755 (executable)
@@ -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: $?";
index e0896e934afe66eb21935a833b8ad520403f2c3e..17d45b957058c14a74eda957c36c5ebe846d6033 100755 (executable)
@@ -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;