From patchwork Thu Nov 30 05:34:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliott Mitchell X-Patchwork-Id: 1871813 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=QFYVmNUH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SkmJV0fYPz1ySd for ; Tue, 5 Dec 2023 14:30:31 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:To:Subject:Date:From: References:In-Reply-To:Message-Id:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mckYH/Qo8/VJ9yTDbUbeP0D3ba/OebCO6dAjLmaYhms=; b=QFYVmNUH830TO0 uET1QWGFUiQs5CBfJgTlX5IC7gTW3WV4B8XLrKQuA5co8/Ew28kIJLOO48TBbqDY/P29DaPrCkxX5 eBofaIXRBps4Rz4q01J9SkZZhTnlpfVJMu94nzAUcQI/RAAHlgw4N8u7utOb7WNF/nWIF1h+lHEuE BjSqxtXHorOmKlKvr5znNGdetozQFrOdaBLLId8PZAP0Kdut7PHeOVWtf/nzulb9FGUEpkHCVZIos trH4C5jWgiX4ipyUuxPmTmDRgSI3fKCsmwgk2+UB5ryWIglfUWOpog9rkq8hoklCMa+ltcmHOVlvy 4E4EmrUIo7E1U0LUwXHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAM6G-0067K7-1b; Tue, 05 Dec 2023 03:27:56 +0000 Received: from mailhost.m5p.com ([74.104.188.4]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAM6B-0067Ji-1E for openwrt-devel@lists.openwrt.org; Tue, 05 Dec 2023 03:27:53 +0000 Received: from m5p.com (mailhost.m5p.com [IPv6:2001:470:1f07:15ff:0:0:0:f7]) by mailhost.m5p.com (8.17.1/8.15.2) with ESMTPS id 3B53Rhin001493 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 4 Dec 2023 22:27:49 -0500 (EST) (envelope-from ehem@m5p.com) Received: (from ehem@localhost) by m5p.com (8.17.1/8.15.2/Submit) id 3B53RhVX001492; Mon, 4 Dec 2023 19:27:43 -0800 (PST) (envelope-from ehem) Message-Id: <4c18693243c6485cd08ad5f8d962cf6e11ad22b0.1701746457.git.ehem+openwrt@m5p.com> In-Reply-To: References: From: Elliott Mitchell Date: Wed, 29 Nov 2023 21:34:11 -0800 Subject: [PATCH 1/5] scripts/kconfig.pl: fixup subroutine style To: openwrt-devel@lists.openwrt.org, nbd@nbd.name X-Spam-Status: No, score=2.1 required=10.0 tests=DATE_IN_PAST_96_XX, KHOP_HELO_FCRDNS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on mattapan.m5p.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231204_192751_880533_327FDA95 X-CRM114-Status: UNSURE ( 5.45 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 2.1 (++) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Match usual Perl style to make the operation of the script easier to understand for future developers. Signed-off-by: Elliott Mitchell --- scripts/kconfig.pl | 27 ++++++++ 1 file changed, 8 insertions(+), 19 deletions(-) Content analysis details: (2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 2.1 DATE_IN_PAST_96_XX Date: is 96 hours or more before Received: date -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Match usual Perl style to make the operation of the script easier to understand for future developers. Signed-off-by: Elliott Mitchell --- scripts/kconfig.pl | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) 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) {