Skip to content

Commit bae4cec

Browse files
Stephen Hemmingermichal42
authored andcommitted
headers_install: use local file handles
Better practice to use 3 arg open and local file handles. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: WANG Cong <amwang@redhat.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
1 parent dbbe33e commit bae4cec

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

‎scripts/headers_install.pl‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__";
2424

2525
foreach my $file (@files) {
26-
local *INFILE;
27-
local *OUTFILE;
2826
my $tmpfile = "$installdir/$file.tmp";
29-
open(INFILE, "<$readdir/$file")
30-
or die "$readdir/$file: $!\n";
31-
open(OUTFILE, ">$tmpfile") or die "$tmpfile: $!\n";
32-
while (my $line = <INFILE>) {
27+
28+
open(my $in, '<', "$readdir/$file")
29+
or die "$readdir/$file: $!\n";
30+
open(my $out, '>', $tmpfile)
31+
or die "$tmpfile: $!\n";
32+
while (my $line = <$in>) {
3333
$line =~ s/([\s(])__user\s/$1/g;
3434
$line =~ s/([\s(])__force\s/$1/g;
3535
$line =~ s/([\s(])__iomem\s/$1/g;
@@ -39,10 +39,11 @@
3939
$line =~ s/(^|\s)(inline)\b/$1__$2__/g;
4040
$line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;
4141
$line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g;
42-
printf OUTFILE "%s", $line;
42+
printf {$out} "%s", $line;
4343
}
44-
close OUTFILE;
45-
close INFILE;
44+
close $out;
45+
close $in;
46+
4647
system $unifdef . " $tmpfile > $installdir/$file";
4748
unlink $tmpfile;
4849
}

0 commit comments

Comments
 (0)