Messages in this thread Patch in this message |  | | Date | Thu, 31 Oct 2013 05:08:07 -0700 | From | Josh Triplett <> | Subject | [PATCH 2/2] scripts/bloat-o-meter: Use .startswith rather than fragile slicing |
| |
str.startswith has existed since at least Python 2.0, in 2000; use it rather than a fragile comparison against an initial slice of a string, which requires hard-coding the length of the string to compare against.
Signed-off-by: Josh Triplett <josh@joshtriplett.org> --- scripts/bloat-o-meter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter index bf24f50..31c9531 100755 --- a/scripts/bloat-o-meter +++ b/scripts/bloat-o-meter @@ -19,7 +19,7 @@ def getsizes(file): size, type, name = l[:-1].split() if type in "tTdDbBrR": # strip generated symbols - if name[:6] == "__mod_": continue + if name.startswith("__mod_"): continue if name == "linux_banner": continue # function names begin with '.' on 64-bit powerpc if "." in name[1:]: name = "static." + name.split(".")[0] -- 1.8.4.2
|  |