diff mbox series

[1/5] scripts/kconfig.pl: fixup subroutine style

Message ID 4c18693243c6485cd08ad5f8d962cf6e11ad22b0.1701746457.git.ehem+openwrt@m5p.com
State New
Headers show
Series Scripting tweaks | expand

Commit Message

Elliott Mitchell Nov. 30, 2023, 5:34 a.m. UTC
Match usual Perl style to make the operation of the script easier
to understand for future developers.

Signed-off-by: Elliott Mitchell <ehem+openwrt@m5p.com>
---
 scripts/kconfig.pl | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)
diff mbox series

Patch

diff --git a/scripts/kconfig.pl b/scripts/kconfig.pl
index 392f1d5841..f7b3814cdd 100755
--- a/scripts/kconfig.pl
+++ b/scripts/kconfig.pl
@@ -13,10 +13,7 @@  my @arg;
 my $PREFIX = "CONFIG_";
 
 sub set_config($$$$) {
-	my $config = shift;
-	my $idx = shift;
-	my $newval = shift;
-	my $mod_plus = shift;
+	my ($config, $idx, $newval, $mod_plus) = @_;
 
 	if (!defined($config->{$idx}) or !$mod_plus or
 	    $config->{$idx} eq '#undef' or $newval eq 'y') {
@@ -25,8 +22,7 @@  sub set_config($$$$) {
 }
 
 sub load_config($$) {
-	my $file = shift;
-	my $mod_plus = shift;
+	my ($file, $mod_plus) = @_;
 	my %config;
 
 	open FILE, "$file" or die "can't open file '$file'";
@@ -48,8 +44,7 @@  sub load_config($$) {
 
 
 sub config_and($$) {
-	my $cfg1 = shift;
-	my $cfg2 = shift;
+	my ($cfg1, $cfg2) = @_;
 	my %config;
 
 	foreach my $config (keys %$cfg1) {
@@ -64,9 +59,7 @@  sub config_and($$) {
 
 
 sub config_add($$$) {
-	my $cfg1 = shift;
-	my $cfg2 = shift;
-	my $mod_plus = shift;
+	my ($cfg1, $cfg2, $mod_plus) = @_;
 	my %config;
 	
 	for ($cfg1, $cfg2) {
@@ -84,9 +77,7 @@  sub config_add($$$) {
 }
 
 sub config_diff($$$) {
-	my $cfg1 = shift;
-	my $cfg2 = shift;
-	my $new_only = shift;
+	my ($cfg1, $cfg2, $new_only) = @_;
 	my %config;
 	
 	foreach my $config (keys %$cfg2) {
@@ -99,8 +90,7 @@  sub config_diff($$$) {
 }
 
 sub config_sub($$) {
-	my $cfg1 = shift;
-	my $cfg2 = shift;
+	my ($cfg1, $cfg2) = @_;
 	my %config = %{$cfg1};
 	my @keys = map {
 		my $expr = $_;
@@ -117,8 +107,7 @@  sub config_sub($$) {
 }
 
 sub print_cfgline($$) {
-	my $name = shift;
-	my $val = shift;
+	my ($name, $val) = @_;
 	if ($val eq '#undef' or $val eq 'n') {
 		print "# $PREFIX$name is not set\n";
 	} else {
@@ -128,7 +117,7 @@  sub print_cfgline($$) {
 
 
 sub dump_config($) {
-	my $cfg = shift;
+	my ($cfg) = @_;
 	die "argument error in dump_config" unless ($cfg);
 	my %config = %$cfg;
 	foreach my $config (sort keys %config) {