]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: expression can use single in instead of 3 API calls.
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>
Tue, 27 Mar 2018 23:42:45 +0000 (07:42 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Thu, 29 Mar 2018 08:28:11 +0000 (16:28 +0800)
change 3 StartsWith() calls to a single 'in' operation.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/Common/Expression.py

index 683604cab5d3a9a83089522e2f9d23d0d4156a9f..30711cedd784f83922430c39b95a7343f09a0473 100644 (file)
@@ -991,7 +991,7 @@ class ValueExpressionEx(ValueExpression):
                                 Item = '0x%x' % TmpValue if type(TmpValue) != type('') else TmpValue\r
                                 if ItemSize == 0:\r
                                     ItemValue, ItemSize = ParseFieldValue(Item)\r
                                 Item = '0x%x' % TmpValue if type(TmpValue) != type('') else TmpValue\r
                                 if ItemSize == 0:\r
                                     ItemValue, ItemSize = ParseFieldValue(Item)\r
-                                    if not (Item.startswith('"') or Item.startswith('L') or Item.startswith('{')) and ItemSize > 1:\r
+                                    if Item[0] not in ['"','L','{'] and ItemSize > 1:\r
                                         raise BadExpression("Byte  array number %s should less than 0xFF." % Item)\r
                                 else:\r
                                     ItemValue = ParseFieldValue(Item)[0]\r
                                         raise BadExpression("Byte  array number %s should less than 0xFF." % Item)\r
                                 else:\r
                                     ItemValue = ParseFieldValue(Item)[0]\r