Skip to content

Commit

Permalink
bc: avoid extra copy of filehandle (#543)
Browse files Browse the repository at this point in the history
* In next_file(), the old filehandle $input is closed if we're not processing the 1st file
* The filehandle $input is global; open it directly instead of copying into it from "IN"
* IN was not referenced anywhere else in the program
  • Loading branch information
mknos committed Apr 11, 2024
1 parent ebd398e commit 710e954
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions bin/bc
Expand Up @@ -2045,8 +2045,7 @@ sub next_file
debug { "reading from $file\n" };

die "path '$file' is a directory\n" if (-d $file);
open(IN, '<', $file) or die("cannot open '$file': $!\n");
$input = IN;
open($input, '<', $file) or die("cannot open '$file': $!\n");
$cur_file = $file;
return 1;

Expand Down

0 comments on commit 710e954

Please sign in to comment.