Skip to content

Commit

Permalink
Modernise Perl file open calls
Browse files Browse the repository at this point in the history
Use regular variables and separate file open modes from filenames.

Suggested-by: perlcritic
  • Loading branch information
pabs3 authored and bagder committed Jun 17, 2023
1 parent a530cb5 commit f2784a9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions checksrc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@
);

sub readskiplist {
open(W, "<$dir/checksrc.skip") or return;
my @all=<W>;
open(my $W, '<', "$dir/checksrc.skip") or return;
my @all=<$W>;
for(@all) {
$windows_os ? $_ =~ s/\r?\n$// : chomp;
$skiplist{$_}=1;
}
close(W);
close($W);
}

# Reads the .checksrc in $dir for any extended warnings to enable locally.
Expand Down Expand Up @@ -380,15 +380,15 @@ sub scanfile {
my $l = "";
my $prep = 0;
my $prevp = 0;
open(R, "<$file") || die "failed to open $file";
open(my $R, '<', $file) || die "failed to open $file";

my $incomment=0;
my @copyright=();
my %includes;
checksrc_clear(); # for file based ignores
accept_violations();

while(<R>) {
while(<$R>) {
$windows_os ? $_ =~ s/\r?\n$// : chomp;
my $l = $_;
my $ol = $l; # keep the unmodified line for error reporting
Expand Down Expand Up @@ -933,7 +933,7 @@ sub scanfile {

checksrc_endoffile($file);

close(R);
close($R);

}

Expand Down

0 comments on commit f2784a9

Please sign in to comment.