From patchwork Thu Apr 14 15:13:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 65835 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp658664qge; Thu, 14 Apr 2016 08:13:47 -0700 (PDT) X-Received: by 10.66.254.74 with SMTP id ag10mr5167452pad.106.1460646827374; Thu, 14 Apr 2016 08:13:47 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id ai6si4384713pad.181.2016.04.14.08.13.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Apr 2016 08:13:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B6E5C1A222C; Thu, 14 Apr 2016 08:13:46 -0700 (PDT) X-Original-To: edk2-devel@ml01.01.org Delivered-To: edk2-devel@ml01.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 2AB3D1A2216 for ; Thu, 14 Apr 2016 08:13:45 -0700 (PDT) Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B308D3C88CE; Thu, 14 Apr 2016 15:13:44 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-89.phx2.redhat.com [10.3.113.89]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3EFDfQM006538; Thu, 14 Apr 2016 11:13:43 -0400 From: Laszlo Ersek To: edk2-devel-01 Date: Thu, 14 Apr 2016 17:13:36 +0200 Message-Id: <1460646818-26390-2-git-send-email-lersek@redhat.com> In-Reply-To: <1460646818-26390-1-git-send-email-lersek@redhat.com> References: <1460646818-26390-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Subject: [edk2] [PATCH 1/3] BaseTools: handleWsMacro: don't search for TAB_WORKSPACE twice X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" The result of the first search can be used for both existence checking and substring extraction. Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- BaseTools/Source/Python/Common/MultipleWorkspace.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 1.8.3.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/BaseTools/Source/Python/Common/MultipleWorkspace.py b/BaseTools/Source/Python/Common/MultipleWorkspace.py index 4e4c37ae1317..dc720aeca57d 100644 --- a/BaseTools/Source/Python/Common/MultipleWorkspace.py +++ b/BaseTools/Source/Python/Common/MultipleWorkspace.py @@ -131,8 +131,8 @@ class MultipleWorkspace(object): PathList = PathStr.split() if PathList: for i, str in enumerate(PathList): - if str.find(TAB_WORKSPACE) != -1: - MacroStartPos = str.find(TAB_WORKSPACE) + MacroStartPos = str.find(TAB_WORKSPACE) + if MacroStartPos != -1: MacroEndPos = str.find(')', MacroStartPos) Substr = str[MacroEndPos+1:] if Substr.startswith('/') or Substr.startswith('\\'):