scripts/bloat-o-meter: use .startswith rather than fragile slicing
authorJosh Triplett <josh@joshtriplett.org>
Thu, 7 Nov 2013 01:03:06 +0000 (12:03 +1100)
committerMichal Marek <mmarek@suse.cz>
Thu, 7 Nov 2013 09:47:13 +0000 (10:47 +0100)
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/bloat-o-meter

index cd2916cfbac4c11956e23b8e0d871f91decaa47f..549d0ab8c66204ec8db65de3d48ce619f7dee925 100755 (executable)
@@ -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
             # statics and some other optimizations adds random .NUMBER
             name = re.sub(r'\.[0-9]+', '', name)