From patchwork Thu May 18 13:18:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Labus X-Patchwork-Id: 763985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wTBbb595pz9s1h for ; Thu, 18 May 2017 23:19:07 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PMLHEpWW"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id:Date:To: From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=jG32DUzx6ufbrkqgCSCsTLBRPqy7AtDebvsqeefhyLk=; b=PMLHEpWWhRPC+J diDOoF/BXrWkk0oGcOHKw389dHC0hduEzU+quZPcPqv0YmF2f9vdZPrfKErpG77xGbZck//2qJjqX VhlIp9vcVHkyN2qvphL1ae7UFdmLyv3hxk4TQMqUmSNKS02HsvelDnjnvAei4wq/arkg0xUC5ZO7L F1TOS4NnSEjtzBxw+RSqcsLWwi9vs2fkbG05eu4a5+E6PE+lA4xnL+elDnwbkHIZal1DqGE0BGJNH FDZvxDfUeuBvk7iDep6tG63VKbkCXtxDAYO4PpuNHkedks2MXwuPDEScx4UXZU29NwR5YiBpF3LMb S0Ay2r4+kBDOL3mNoysA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dBLKX-0000i9-U9; Thu, 18 May 2017 13:19:01 +0000 Received: from discovery.labus-online.de ([2001:41d0:2:32cb::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dBLKT-0000fN-PH for lede-dev@lists.infradead.org; Thu, 18 May 2017 13:18:59 +0000 Received: from eclipse.fritz.box (unknown [IPv6:2a02:908:1964:e9a0:be5f:f4ff:fe44:63d4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by discovery.labus-online.de (Postfix) with ESMTPSA id 0946D1220155 for ; Thu, 18 May 2017 15:18:30 +0200 (CEST) From: Julian Labus To: lede-dev@lists.infradead.org Date: Thu, 18 May 2017 15:18:25 +0200 Message-Id: <20170518131825.3052-1-julian@labus-online.de> X-Mailer: git-send-email 2.11.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170518_061857_981854_7269087A X-CRM114-Status: UNSURE ( 7.45 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCH usbmode] fix indices of messages X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org the way how the script checked if a key already exists in a hash leads to wrong indices for %messages. Signed-off-by: Julian Labus --- convert-modeswitch.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/convert-modeswitch.pl b/convert-modeswitch.pl index 7b2323b..6e7bb86 100755 --- a/convert-modeswitch.pl +++ b/convert-modeswitch.pl @@ -7,12 +7,13 @@ my %devices; sub add_message { my $msg = shift; - my $val = $messages{$msg}; - - $val or do { + my $val; + if (exists $messages{$msg}) { + $val = $messages{$msg}; + } else { $val = $msg_ctr++; $messages{$msg} = $val; - }; + } return $val; }