public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1 0/4] BaseTools: remove un-needed code
@ 2018-03-30  0:19 Jaben Carsey
  2018-03-30  0:19 ` [PATCH v1 1/4] BaseTools: change hex parsing to use built in Jaben Carsey
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jaben Carsey @ 2018-03-30  0:19 UTC (permalink / raw)
  To: edk2-devel

improve the code by removing uncalled functions and using more built in
functionality.

Jaben Carsey (4):
  BaseTools: change hex parsing to use built in
  BaseTools: remove uncalled function
  BaseTools: make static functions when self is not needed
  BaseTools: remove uncalled functions

 BaseTools/Source/Python/Common/FdfParserLite.py      | 63 +++++--------------
 BaseTools/Source/Python/Ecc/CodeFragmentCollector.py | 36 +----------
 BaseTools/Source/Python/Eot/CodeFragmentCollector.py | 36 +----------
 BaseTools/Source/Python/GenFds/FdfParser.py          | 66 +++++---------------
 4 files changed, 32 insertions(+), 169 deletions(-)

-- 
2.16.2.windows.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v1 1/4] BaseTools: change hex parsing to use built in
  2018-03-30  0:19 [PATCH v1 0/4] BaseTools: remove un-needed code Jaben Carsey
@ 2018-03-30  0:19 ` Jaben Carsey
  2018-03-30  0:19 ` [PATCH v1 2/4] BaseTools: remove uncalled function Jaben Carsey
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jaben Carsey @ 2018-03-30  0:19 UTC (permalink / raw)
  To: edk2-devel; +Cc: Yonghong Zhu, Liming Gao

use <char> in string.hexdigits instead of custom functions.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
 BaseTools/Source/Python/Common/FdfParserLite.py | 26 +++-----------------
 BaseTools/Source/Python/GenFds/FdfParser.py     | 26 +++-----------------
 2 files changed, 8 insertions(+), 44 deletions(-)

diff --git a/BaseTools/Source/Python/Common/FdfParserLite.py b/BaseTools/Source/Python/Common/FdfParserLite.py
index b7b5e21a9e3f..4638916fab2c 100644
--- a/BaseTools/Source/Python/Common/FdfParserLite.py
+++ b/BaseTools/Source/Python/Common/FdfParserLite.py
@@ -23,6 +23,7 @@ from Common.LongFilePathSupport import OpenLongFilePath as open
 from Common.MultipleWorkspace import MultipleWorkspace as mws
 from Common.RangeExpression import RangeExpression
 from Common.GlobalData import *
+import string
 
 ##define T_CHAR_SPACE                ' '
 ##define T_CHAR_NULL                 '\0'
@@ -974,32 +975,13 @@ class FdfParser(object):
             
         self.__GetOneChar()
     
-    ## __HexDigit() method
-    #
-    #   Whether char input is a Hex data bit
-    #
-    #   @param  self        The object pointer
-    #   @param  TempChar    The char to test
-    #   @retval True        The char is a Hex data bit
-    #   @retval False       The char is NOT a Hex data bit
-    #
-    def __HexDigit(self, TempChar):
-        if (TempChar >= 'a' and TempChar <= 'f') or (TempChar >= 'A' and TempChar <= 'F') \
-                or (TempChar >= '0' and TempChar <= '9'):
-                    return True
-        else:
-            return False
-    
     def __IsHex(self, HexStr):
         if not HexStr.upper().startswith("0X"):
             return False
         if len(self.__Token) <= 2:
             return False
-        charList = [c for c in HexStr[2 : ] if not self.__HexDigit( c)]
-        if len(charList) == 0:
-            return True
-        else:
-            return False    
+        return True if all(x in string.hexdigits for x in HexStr[2:]) else False
+
     ## __GetNextHexNumber() method
     #
     #   Get next HEX data before a seperator
@@ -3457,7 +3439,7 @@ class FdfParser(object):
             raise Warning("expected Component type At Line ", self.FileName, self.CurrentLineNumber)
         if self.__Token not in ("FIT", "PAL_B", "PAL_A", "OEM"):
             if not self.__Token.startswith("0x") or len(self.__Token) < 3 or len(self.__Token) > 4 or \
-                not self.__HexDigit(self.__Token[2]) or not self.__HexDigit(self.__Token[-1]):
+                not self.__Token[2] in string.hexdigits or not self.__Token[-1] in string.hexdigits:
                 raise Warning("Unknown location type At line ", self.FileName, self.CurrentLineNumber)
         CompStatementObj.CompType = self.__Token
         
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 9903e9570cf9..4dc686922b5a 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -42,6 +42,7 @@ import ComponentStatement
 import OptionRom
 import OptRomInfStatement
 import OptRomFileStatement
+import string
 
 from GenFdsGlobalVariable import GenFdsGlobalVariable
 from Common.BuildToolError import *
@@ -1195,32 +1196,13 @@ class FdfParser:
 
         self.__GetOneChar()
 
-    ## __HexDigit() method
-    #
-    #   Whether char input is a Hex data bit
-    #
-    #   @param  self        The object pointer
-    #   @param  TempChar    The char to test
-    #   @retval True        The char is a Hex data bit
-    #   @retval False       The char is NOT a Hex data bit
-    #
-    def __HexDigit(self, TempChar):
-        if (TempChar >= 'a' and TempChar <= 'f') or (TempChar >= 'A' and TempChar <= 'F') \
-                or (TempChar >= '0' and TempChar <= '9'):
-                    return True
-        else:
-            return False
-
     def __IsHex(self, HexStr):
         if not HexStr.upper().startswith("0X"):
             return False
         if len(self.__Token) <= 2:
             return False
-        charList = [c for c in HexStr[2 : ] if not self.__HexDigit( c)]
-        if len(charList) == 0:
-            return True
-        else:
-            return False
+        return True if all(x in string.hexdigits for x in HexStr[2:]) else False
+
     ## __GetNextHexNumber() method
     #
     #   Get next HEX data before a seperator
@@ -4299,7 +4281,7 @@ class FdfParser:
             raise Warning("expected Component type", self.FileName, self.CurrentLineNumber)
         if self.__Token not in ("FIT", "PAL_B", "PAL_A", "OEM"):
             if not self.__Token.startswith("0x") or len(self.__Token) < 3 or len(self.__Token) > 4 or \
-                not self.__HexDigit(self.__Token[2]) or not self.__HexDigit(self.__Token[-1]):
+                not self.__Token[2] in string.hexdigits or not self.__Token[-1] in string.hexdigits:
                 raise Warning("Unknown location type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
         CompStatementObj.CompType = self.__Token
 
-- 
2.16.2.windows.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 2/4] BaseTools: remove uncalled function
  2018-03-30  0:19 [PATCH v1 0/4] BaseTools: remove un-needed code Jaben Carsey
  2018-03-30  0:19 ` [PATCH v1 1/4] BaseTools: change hex parsing to use built in Jaben Carsey
@ 2018-03-30  0:19 ` Jaben Carsey
  2018-03-30  0:19 ` [PATCH v1 3/4] BaseTools: make static functions when self is not needed Jaben Carsey
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jaben Carsey @ 2018-03-30  0:19 UTC (permalink / raw)
  To: edk2-devel; +Cc: Yonghong Zhu, Liming Gao

no one calls __IsWhiteSpace() (none of the 4 copies)

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
 BaseTools/Source/Python/Common/FdfParserLite.py      | 15 ---------------
 BaseTools/Source/Python/Ecc/CodeFragmentCollector.py | 17 +----------------
 BaseTools/Source/Python/Eot/CodeFragmentCollector.py | 17 +----------------
 BaseTools/Source/Python/GenFds/FdfParser.py          | 15 ---------------
 4 files changed, 2 insertions(+), 62 deletions(-)

diff --git a/BaseTools/Source/Python/Common/FdfParserLite.py b/BaseTools/Source/Python/Common/FdfParserLite.py
index 4638916fab2c..9219cdb1bcce 100644
--- a/BaseTools/Source/Python/Common/FdfParserLite.py
+++ b/BaseTools/Source/Python/Common/FdfParserLite.py
@@ -183,21 +183,6 @@ class FdfParser(object):
         
         self.__WipeOffArea = []
 
-    ## __IsWhiteSpace() method
-    #
-    #   Whether char at current FileBufferPos is whitespace
-    #
-    #   @param  self        The object pointer
-    #   @param  Char        The char to test
-    #   @retval True        The char is a kind of white space
-    #   @retval False       The char is NOT a kind of white space
-    #
-    def __IsWhiteSpace(self, Char):
-        if Char in (T_CHAR_NULL, T_CHAR_CR, T_CHAR_SPACE, T_CHAR_TAB, T_CHAR_LF):
-            return True
-        else:
-            return False
-
     ## __SkipWhiteSpace() method
     #
     #   Skip white spaces from current char, return number of chars skipped
diff --git a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
index 171600feebf9..fc50eb27a78d 100644
--- a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
+++ b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
@@ -1,7 +1,7 @@
 ## @file
 # preprocess source file
 #
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -75,21 +75,6 @@ class CodeFragmentCollector:
         self.__Token = ""
         self.__SkippedChars = ""
 
-    ## __IsWhiteSpace() method
-    #
-    #   Whether char at current FileBufferPos is whitespace
-    #
-    #   @param  self        The object pointer
-    #   @param  Char        The char to test
-    #   @retval True        The char is a kind of white space
-    #   @retval False       The char is NOT a kind of white space
-    #
-    def __IsWhiteSpace(self, Char):
-        if Char in (T_CHAR_NULL, T_CHAR_CR, T_CHAR_SPACE, T_CHAR_TAB, T_CHAR_LF):
-            return True
-        else:
-            return False
-
     ## __SkipWhiteSpace() method
     #
     #   Skip white spaces from current char, return number of chars skipped
diff --git a/BaseTools/Source/Python/Eot/CodeFragmentCollector.py b/BaseTools/Source/Python/Eot/CodeFragmentCollector.py
index bb78a0f882d5..00668eca3421 100644
--- a/BaseTools/Source/Python/Eot/CodeFragmentCollector.py
+++ b/BaseTools/Source/Python/Eot/CodeFragmentCollector.py
@@ -1,7 +1,7 @@
 ## @file
 # preprocess source file
 #
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -73,21 +73,6 @@ class CodeFragmentCollector:
         self.__Token = ""
         self.__SkippedChars = ""
 
-    ## __IsWhiteSpace() method
-    #
-    #   Whether char at current FileBufferPos is whitespace
-    #
-    #   @param  self        The object pointer
-    #   @param  Char        The char to test
-    #   @retval True        The char is a kind of white space
-    #   @retval False       The char is NOT a kind of white space
-    #
-    def __IsWhiteSpace(self, Char):
-        if Char in (T_CHAR_NULL, T_CHAR_CR, T_CHAR_SPACE, T_CHAR_TAB, T_CHAR_LF):
-            return True
-        else:
-            return False
-
     ## __SkipWhiteSpace() method
     #
     #   Skip white spaces from current char, return number of chars skipped
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 4dc686922b5a..9cdee358d24e 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -275,21 +275,6 @@ class FdfParser:
         if GenFdsGlobalVariable.WorkSpaceDir == '':
             GenFdsGlobalVariable.WorkSpaceDir = os.getenv("WORKSPACE")
 
-    ## __IsWhiteSpace() method
-    #
-    #   Whether char at current FileBufferPos is whitespace
-    #
-    #   @param  self        The object pointer
-    #   @param  Char        The char to test
-    #   @retval True        The char is a kind of white space
-    #   @retval False       The char is NOT a kind of white space
-    #
-    def __IsWhiteSpace(self, Char):
-        if Char in (T_CHAR_NULL, T_CHAR_CR, T_CHAR_SPACE, T_CHAR_TAB, T_CHAR_LF):
-            return True
-        else:
-            return False
-
     ## __SkipWhiteSpace() method
     #
     #   Skip white spaces from current char, return number of chars skipped
-- 
2.16.2.windows.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 3/4] BaseTools: make static functions when self is not needed
  2018-03-30  0:19 [PATCH v1 0/4] BaseTools: remove un-needed code Jaben Carsey
  2018-03-30  0:19 ` [PATCH v1 1/4] BaseTools: change hex parsing to use built in Jaben Carsey
  2018-03-30  0:19 ` [PATCH v1 2/4] BaseTools: remove uncalled function Jaben Carsey
@ 2018-03-30  0:19 ` Jaben Carsey
  2018-03-30  0:19 ` [PATCH v1 4/4] BaseTools: remove uncalled functions Jaben Carsey
  2018-04-03  9:26 ` [PATCH v1 0/4] BaseTools: remove un-needed code Zhu, Yonghong
  4 siblings, 0 replies; 6+ messages in thread
From: Jaben Carsey @ 2018-03-30  0:19 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu

remove self, and add @staticmethod to functions

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>
---
 BaseTools/Source/Python/Common/FdfParserLite.py | 22 ++++++++---------
 BaseTools/Source/Python/GenFds/FdfParser.py     | 25 ++++++++++----------
 2 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/BaseTools/Source/Python/Common/FdfParserLite.py b/BaseTools/Source/Python/Common/FdfParserLite.py
index 9219cdb1bcce..07f44567cfb5 100644
--- a/BaseTools/Source/Python/Common/FdfParserLite.py
+++ b/BaseTools/Source/Python/Common/FdfParserLite.py
@@ -2130,13 +2130,12 @@ class FdfParser(object):
     #
     #   Check whether reloc strip flag can be set for a file type.
     #
-    #   @param  self        The object pointer
     #   @param  FileType    The file type to check with
     #   @retval True        This type could have relocation strip flag
     #   @retval False       No way to have it
     #
-    
-    def __FileCouldHaveRelocFlag (self, FileType):
+    @staticmethod
+    def __FileCouldHaveRelocFlag (FileType):
         if FileType in ('SEC', 'PEI_CORE', 'PEIM', 'PEI_DXE_COMBO'):
             return True
         else:
@@ -2146,13 +2145,12 @@ class FdfParser(object):
     #
     #   Check whether reloc strip flag can be set for a section type.
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check with
     #   @retval True        This type could have relocation strip flag
     #   @retval False       No way to have it
     #
-    
-    def __SectionCouldHaveRelocFlag (self, SectionType):
+    @staticmethod
+    def __SectionCouldHaveRelocFlag (SectionType):
         if SectionType in ('TE', 'PE32'):
             return True
         else:
@@ -3154,12 +3152,12 @@ class FdfParser(object):
     #
     #   Get whether a section could be optional
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check
     #   @retval True        section could be optional
     #   @retval False       section never optional
     #
-    def __RuleSectionCouldBeOptional(self, SectionType):
+    @staticmethod
+    def __RuleSectionCouldBeOptional(SectionType):
         if SectionType in ("DXE_DEPEX", "UI", "VERSION", "PEI_DEPEX", "RAW", "SMM_DEPEX"):
             return True
         else:
@@ -3169,12 +3167,12 @@ class FdfParser(object):
     #
     #   Get whether a section could have build number information
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check
     #   @retval True        section could have build number information
     #   @retval False       section never have build number information
     #
-    def __RuleSectionCouldHaveBuildNum(self, SectionType):
+    @staticmethod
+    def __RuleSectionCouldHaveBuildNum(SectionType):
         if SectionType in ("VERSION"):
             return True
         else:
@@ -3184,12 +3182,12 @@ class FdfParser(object):
     #
     #   Get whether a section could have string
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check
     #   @retval True        section could have string
     #   @retval False       section never have string
     #
-    def __RuleSectionCouldHaveString(self, SectionType):
+    @staticmethod
+    def __RuleSectionCouldHaveString(SectionType):
         if SectionType in ("UI", "VERSION"):
             return True
         else:
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 9cdee358d24e..8945e3e2b1cc 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -704,7 +704,8 @@ class FdfParser:
         # Preprocess done.
         self.Rewind()
         
-    def __GetIfListCurrentItemStat(self, IfList):
+    @staticmethod
+    def __GetIfListCurrentItemStat(IfList):
         if len(IfList) == 0:
             return True
         
@@ -2628,13 +2629,12 @@ class FdfParser:
     #
     #   Check whether reloc strip flag can be set for a file type.
     #
-    #   @param  self        The object pointer
     #   @param  FileType    The file type to check with
     #   @retval True        This type could have relocation strip flag
     #   @retval False       No way to have it
     #
-
-    def __FileCouldHaveRelocFlag (self, FileType):
+    @staticmethod
+    def __FileCouldHaveRelocFlag (FileType):
         if FileType in ('SEC', 'PEI_CORE', 'PEIM', 'PEI_DXE_COMBO'):
             return True
         else:
@@ -2644,13 +2644,12 @@ class FdfParser:
     #
     #   Check whether reloc strip flag can be set for a section type.
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check with
     #   @retval True        This type could have relocation strip flag
     #   @retval False       No way to have it
     #
-
-    def __SectionCouldHaveRelocFlag (self, SectionType):
+    @staticmethod
+    def __SectionCouldHaveRelocFlag (SectionType):
         if SectionType in ('TE', 'PE32'):
             return True
         else:
@@ -3991,12 +3990,12 @@ class FdfParser:
     #
     #   Get whether a section could be optional
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check
     #   @retval True        section could be optional
     #   @retval False       section never optional
     #
-    def __RuleSectionCouldBeOptional(self, SectionType):
+    @staticmethod
+    def __RuleSectionCouldBeOptional(SectionType):
         if SectionType in ("DXE_DEPEX", "UI", "VERSION", "PEI_DEPEX", "RAW", "SMM_DEPEX"):
             return True
         else:
@@ -4006,12 +4005,12 @@ class FdfParser:
     #
     #   Get whether a section could have build number information
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check
     #   @retval True        section could have build number information
     #   @retval False       section never have build number information
     #
-    def __RuleSectionCouldHaveBuildNum(self, SectionType):
+    @staticmethod
+    def __RuleSectionCouldHaveBuildNum(SectionType):
         if SectionType in ("VERSION"):
             return True
         else:
@@ -4021,12 +4020,12 @@ class FdfParser:
     #
     #   Get whether a section could have string
     #
-    #   @param  self        The object pointer
     #   @param  SectionType The section type to check
     #   @retval True        section could have string
     #   @retval False       section never have string
     #
-    def __RuleSectionCouldHaveString(self, SectionType):
+    @staticmethod
+    def __RuleSectionCouldHaveString(SectionType):
         if SectionType in ("UI", "VERSION"):
             return True
         else:
-- 
2.16.2.windows.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 4/4] BaseTools: remove uncalled functions
  2018-03-30  0:19 [PATCH v1 0/4] BaseTools: remove un-needed code Jaben Carsey
                   ` (2 preceding siblings ...)
  2018-03-30  0:19 ` [PATCH v1 3/4] BaseTools: make static functions when self is not needed Jaben Carsey
@ 2018-03-30  0:19 ` Jaben Carsey
  2018-04-03  9:26 ` [PATCH v1 0/4] BaseTools: remove un-needed code Zhu, Yonghong
  4 siblings, 0 replies; 6+ messages in thread
From: Jaben Carsey @ 2018-03-30  0:19 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu

this same function in 2 classes is never called.

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>
---
 BaseTools/Source/Python/Ecc/CodeFragmentCollector.py | 19 -------------------
 BaseTools/Source/Python/Eot/CodeFragmentCollector.py | 19 -------------------
 2 files changed, 38 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
index fc50eb27a78d..f8b0a9ecf4c0 100644
--- a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
+++ b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
@@ -75,25 +75,6 @@ class CodeFragmentCollector:
         self.__Token = ""
         self.__SkippedChars = ""
 
-    ## __SkipWhiteSpace() method
-    #
-    #   Skip white spaces from current char, return number of chars skipped
-    #
-    #   @param  self        The object pointer
-    #   @retval Count       The number of chars skipped
-    #
-    def __SkipWhiteSpace(self):
-        Count = 0
-        while not self.__EndOfFile():
-            Count += 1
-            if self.__CurrentChar() in (T_CHAR_NULL, T_CHAR_CR, T_CHAR_LF, T_CHAR_SPACE, T_CHAR_TAB):
-                self.__SkippedChars += str(self.__CurrentChar())
-                self.__GetOneChar()
-
-            else:
-                Count = Count - 1
-                return Count
-
     ## __EndOfFile() method
     #
     #   Judge current buffer pos is at file end
diff --git a/BaseTools/Source/Python/Eot/CodeFragmentCollector.py b/BaseTools/Source/Python/Eot/CodeFragmentCollector.py
index 00668eca3421..c7218439b7ea 100644
--- a/BaseTools/Source/Python/Eot/CodeFragmentCollector.py
+++ b/BaseTools/Source/Python/Eot/CodeFragmentCollector.py
@@ -73,25 +73,6 @@ class CodeFragmentCollector:
         self.__Token = ""
         self.__SkippedChars = ""
 
-    ## __SkipWhiteSpace() method
-    #
-    #   Skip white spaces from current char, return number of chars skipped
-    #
-    #   @param  self        The object pointer
-    #   @retval Count       The number of chars skipped
-    #
-    def __SkipWhiteSpace(self):
-        Count = 0
-        while not self.__EndOfFile():
-            Count += 1
-            if self.__CurrentChar() in (T_CHAR_NULL, T_CHAR_CR, T_CHAR_LF, T_CHAR_SPACE, T_CHAR_TAB):
-                self.__SkippedChars += str(self.__CurrentChar())
-                self.__GetOneChar()
-
-            else:
-                Count = Count - 1
-                return Count
-
     ## __EndOfFile() method
     #
     #   Judge current buffer pos is at file end
-- 
2.16.2.windows.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 0/4] BaseTools: remove un-needed code
  2018-03-30  0:19 [PATCH v1 0/4] BaseTools: remove un-needed code Jaben Carsey
                   ` (3 preceding siblings ...)
  2018-03-30  0:19 ` [PATCH v1 4/4] BaseTools: remove uncalled functions Jaben Carsey
@ 2018-04-03  9:26 ` Zhu, Yonghong
  4 siblings, 0 replies; 6+ messages in thread
From: Zhu, Yonghong @ 2018-04-03  9:26 UTC (permalink / raw)
  To: Carsey, Jaben, edk2-devel@lists.01.org

Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> 

Best Regards,
Zhu Yonghong


-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jaben Carsey
Sent: Friday, March 30, 2018 8:19 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH v1 0/4] BaseTools: remove un-needed code

improve the code by removing uncalled functions and using more built in functionality.

Jaben Carsey (4):
  BaseTools: change hex parsing to use built in
  BaseTools: remove uncalled function
  BaseTools: make static functions when self is not needed
  BaseTools: remove uncalled functions

 BaseTools/Source/Python/Common/FdfParserLite.py      | 63 +++++--------------
 BaseTools/Source/Python/Ecc/CodeFragmentCollector.py | 36 +----------  BaseTools/Source/Python/Eot/CodeFragmentCollector.py | 36 +----------
 BaseTools/Source/Python/GenFds/FdfParser.py          | 66 +++++---------------
 4 files changed, 32 insertions(+), 169 deletions(-)

--
2.16.2.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-04-03  9:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-30  0:19 [PATCH v1 0/4] BaseTools: remove un-needed code Jaben Carsey
2018-03-30  0:19 ` [PATCH v1 1/4] BaseTools: change hex parsing to use built in Jaben Carsey
2018-03-30  0:19 ` [PATCH v1 2/4] BaseTools: remove uncalled function Jaben Carsey
2018-03-30  0:19 ` [PATCH v1 3/4] BaseTools: make static functions when self is not needed Jaben Carsey
2018-03-30  0:19 ` [PATCH v1 4/4] BaseTools: remove uncalled functions Jaben Carsey
2018-04-03  9:26 ` [PATCH v1 0/4] BaseTools: remove un-needed code Zhu, Yonghong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox