Skip to content

Commit cbec18a

Browse files
JoePerchestorvalds
authored andcommitted
checkpatch: use a more consistent function argument style
Instead of array indexing $_, use temporary variables like all the other subroutines in the script use. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 9b0fa60 commit cbec18a

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

‎scripts/checkpatch.pl‎

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,50 +1431,61 @@ sub possible {
14311431
my $prefix = '';
14321432

14331433
sub show_type {
1434-
return defined $use_type{$_[0]} if (scalar keys %use_type > 0);
1434+
my ($type) = @_;
14351435

1436-
return !defined $ignore_type{$_[0]};
1436+
return defined $use_type{$type} if (scalar keys %use_type > 0);
1437+
1438+
return !defined $ignore_type{$type};
14371439
}
14381440

14391441
sub report {
1440-
if (!show_type($_[1]) ||
1441-
(defined $tst_only && $_[2] !~ /\Q$tst_only\E/)) {
1442+
my ($level, $type, $msg) = @_;
1443+
1444+
if (!show_type($type) ||
1445+
(defined $tst_only && $msg !~ /\Q$tst_only\E/)) {
14421446
return 0;
14431447
}
14441448
my $line;
14451449
if ($show_types) {
1446-
$line = "$prefix$_[0]:$_[1]: $_[2]\n";
1450+
$line = "$prefix$level:$type: $msg\n";
14471451
} else {
1448-
$line = "$prefix$_[0]: $_[2]\n";
1452+
$line = "$prefix$level: $msg\n";
14491453
}
14501454
$line = (split('\n', $line))[0] . "\n" if ($terse);
14511455

14521456
push(our @report, $line);
14531457

14541458
return 1;
14551459
}
1460+
14561461
sub report_dump {
14571462
our @report;
14581463
}
14591464

14601465
sub ERROR {
1461-
if (report("ERROR", $_[0], $_[1])) {
1466+
my ($type, $msg) = @_;
1467+
1468+
if (report("ERROR", $type, $msg)) {
14621469
our $clean = 0;
14631470
our $cnt_error++;
14641471
return 1;
14651472
}
14661473
return 0;
14671474
}
14681475
sub WARN {
1469-
if (report("WARNING", $_[0], $_[1])) {
1476+
my ($type, $msg) = @_;
1477+
1478+
if (report("WARNING", $type, $msg)) {
14701479
our $clean = 0;
14711480
our $cnt_warn++;
14721481
return 1;
14731482
}
14741483
return 0;
14751484
}
14761485
sub CHK {
1477-
if ($check && report("CHECK", $_[0], $_[1])) {
1486+
my ($type, $msg) = @_;
1487+
1488+
if ($check && report("CHECK", $type, $msg)) {
14781489
our $clean = 0;
14791490
our $cnt_chk++;
14801491
return 1;

0 commit comments

Comments
 (0)