From a77e5bcac54d2e2437d7deaec9af5362c9220037 Mon Sep 17 00:00:00 2001 From: "Carsey, Jaben" Date: Wed, 29 Aug 2018 06:50:34 +0800 Subject: [PATCH] BaseTools: minimize assignment processing Reverse the checking and only assign once to each variable. Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu --- BaseTools/Source/Python/Workspace/DscBuildData.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index ca20f8dd6c..eeeb08b4b6 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1534,15 +1534,16 @@ class DscBuildData(PlatformBuildClassObject): PcdValueDict[PcdCName, TokenSpaceGuid] = {SkuName:(PcdValue, DatumType, MaxDatumSize)} for ((PcdCName, TokenSpaceGuid), PcdSetting) in PcdValueDict.iteritems(): - PcdValue = None - DatumType = None - MaxDatumSize = None - if TAB_COMMON in PcdSetting: - PcdValue, DatumType, MaxDatumSize = PcdSetting[TAB_COMMON] - if TAB_DEFAULT in PcdSetting: - PcdValue, DatumType, MaxDatumSize = PcdSetting[TAB_DEFAULT] if self.SkuIdMgr.SystemSkuId in PcdSetting: PcdValue, DatumType, MaxDatumSize = PcdSetting[self.SkuIdMgr.SystemSkuId] + elif TAB_DEFAULT in PcdSetting: + PcdValue, DatumType, MaxDatumSize = PcdSetting[TAB_DEFAULT] + elif TAB_COMMON in PcdSetting: + PcdValue, DatumType, MaxDatumSize = PcdSetting[TAB_COMMON] + else: + PcdValue = None + DatumType = None + MaxDatumSize = None Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject( PcdCName,