From 8252e6bf2ddfa210992c3590008029933592ad16 Mon Sep 17 00:00:00 2001 From: "Carsey, Jaben" Date: Sat, 28 Apr 2018 06:32:54 +0800 Subject: BaseTools: dont make iterator into list if not needed functions (like join) can use the iterator just as easily. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu --- BaseTools/Source/Python/Common/String.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BaseTools/Source/Python/Common/String.py') diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Python/Common/String.py index ee26d7f7b1..34361ecdd5 100644 --- a/BaseTools/Source/Python/Common/String.py +++ b/BaseTools/Source/Python/Common/String.py @@ -818,27 +818,27 @@ def StringToArray(String): if isinstance(String, unicode): if len(unicode) == 0: return "{0x00,0x00}" - return "{%s,0x00,0x00}" % ",".join(["0x%02x,0x00" % ord(C) for C in String]) + return "{%s,0x00,0x00}" % ",".join("0x%02x,0x00" % ord(C) for C in String) elif String.startswith('L"'): if String == "L\"\"": return "{0x00,0x00}" else: - return "{%s,0x00,0x00}" % ",".join(["0x%02x,0x00" % ord(C) for C in String[2:-1]]) + return "{%s,0x00,0x00}" % ",".join("0x%02x,0x00" % ord(C) for C in String[2:-1]) elif String.startswith('"'): if String == "\"\"": return "{0x00,0x00}" else: StringLen = len(String[1:-1]) if StringLen % 2: - return "{%s,0x00}" % ",".join(["0x%02x" % ord(C) for C in String[1:-1]]) + return "{%s,0x00}" % ",".join("0x%02x" % ord(C) for C in String[1:-1]) else: - return "{%s,0x00,0x00}" % ",".join(["0x%02x" % ord(C) for C in String[1:-1]]) + return "{%s,0x00,0x00}" % ",".join("0x%02x" % ord(C) for C in String[1:-1]) elif String.startswith('{'): StringLen = len(String.split(",")) if StringLen % 2: - return "{%s,0x00}" % ",".join([ C.strip() for C in String[1:-1].split(',')]) + return "{%s,0x00}" % ",".join(C.strip() for C in String[1:-1].split(',')) else: - return "{%s}" % ",".join([ C.strip() for C in String[1:-1].split(',')]) + return "{%s}" % ",".join(C.strip() for C in String[1:-1].split(',')) else: if len(String.split()) % 2: -- cgit v1.2.3