From nobody Sun Jul 13 16:11:02 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1520982715571382.3106836322122; Tue, 13 Mar 2018 16:11:55 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 40D5C22603B11; Tue, 13 Mar 2018 16:05:27 -0700 (PDT) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9D716224CCC31 for ; Tue, 13 Mar 2018 16:05:23 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2018 16:11:45 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga005.jf.intel.com with ESMTP; 13 Mar 2018 16:11:45 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,466,1515484800"; d="scan'208";a="207954916" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 13 Mar 2018 16:11:33 -0700 Message-Id: <6ac40f3a1349fa1ae00458f532bbc1138b0f536b.1520982577.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 3/5] BaseTools: Expression - change from series of if to elif X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" since the first character of the string cannot be found by multiple if statements, use elif to optomize the behavior. Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/Expression.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Sourc= e/Python/Common/Expression.py index c7037dd0d00b..85c1ce9bbc09 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -93,18 +93,18 @@ def SplitPcdValueString(String): for i, ch in enumerate(String): if ch =3D=3D '(': InParenthesis +=3D 1 - if ch =3D=3D ')': + elif ch =3D=3D ')': if InParenthesis: InParenthesis -=3D 1 else: raise BadExpression(ERR_STRING_TOKEN % Item) - if ch =3D=3D '"' and not InSingleQuote: + elif ch =3D=3D '"' and not InSingleQuote: if String[i-1] !=3D '\\': InDoubleQuote =3D not InDoubleQuote - if ch =3D=3D "'" and not InDoubleQuote: + elif ch =3D=3D "'" and not InDoubleQuote: if String[i-1] !=3D '\\': InSingleQuote =3D not InSingleQuote - if ch =3D=3D ',': + elif ch =3D=3D ',': if InParenthesis or InSingleQuote or InDoubleQuote: Item +=3D String[i] continue --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel