diff mbox

[edk2,1/3] BaseTools: handleWsMacro: don't search for TAB_WORKSPACE twice

Message ID 1460646818-26390-2-git-send-email-lersek@redhat.com
State New
Headers show

Commit Message

Laszlo Ersek April 14, 2016, 3:13 p.m. UTC
The result of the first search can be used for both existence checking and
substring extraction.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

---
 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 mbox

Patch

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('\\'):