js generator: avoid doing two tests per line

combine the checks and make the second dependent from the former

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2023-04-17 14:07:18 +02:00
parent d310270dc7
commit 052bd210b1

View File

@ -122,8 +122,7 @@ sub extract_msg {
foreach my $s (@$sources) { foreach my $s (@$sources) {
open(my $SRC_FH, '<', $s) || die "unable to open file '$s' - $!\n"; open(my $SRC_FH, '<', $s) || die "unable to open file '$s' - $!\n";
while(defined(my $line = <$SRC_FH>)) { while(defined(my $line = <$SRC_FH>)) {
next if $line =~ m/^\s*function gettext/; if ($line =~ m/gettext\s*\(/ && $line !~ m/^\s*function gettext/) {
if ($line =~ m/gettext\s*\(/) {
extract_msg($s, $., $line); extract_msg($s, $., $line);
} }
} }