Skip to content

Commit c2e182f

Browse files
joshtriplettmichal42
authored andcommitted
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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
1 parent 5a7b2d2 commit c2e182f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scripts/bloat-o-meter

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def getsizes(file):
1919
size, type, name = l[:-1].split()
2020
if type in "tTdDbBrR":
2121
# strip generated symbols
22-
if name[:6] == "__mod_": continue
22+
if name.startswith("__mod_"): continue
2323
if name == "linux_banner": continue
2424
# statics and some other optimizations adds random .NUMBER
2525
name = re.sub(r'\.[0-9]+', '', name)

0 commit comments

Comments
 (0)