summaryrefslogtreecommitdiff
path: root/scripts/kallsyms.c
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2019-11-23 19:04:36 +0300
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-11-25 15:03:51 +0300
commitaa915245005bdb45ccbc96964853b4a27646390f (patch)
treed5ad9d568971cee9a0c122e571a593293182a4a7 /scripts/kallsyms.c
parent29e55ad3d5f50eca6f8762749da85d6fa1250061 (diff)
downloadlinux-aa915245005bdb45ccbc96964853b4a27646390f.tar.xz
scripts/kallsyms: replace prefix_underscores_count() with strspn()
You can do equivalent things with strspn(). I do not see noticeable performance difference. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/kallsyms.c')
-rw-r--r--scripts/kallsyms.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index baa2fa5692b0..89cc7c098c51 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -661,16 +661,6 @@ static int may_be_linker_script_provide_symbol(const struct sym_entry *se)
return 0;
}
-static int prefix_underscores_count(const char *str)
-{
- const char *tail = str;
-
- while (*tail == '_')
- tail++;
-
- return tail - str;
-}
-
static int compare_symbols(const void *a, const void *b)
{
const struct sym_entry *sa;
@@ -699,8 +689,8 @@ static int compare_symbols(const void *a, const void *b)
return wa - wb;
/* sort by the number of prefix underscores */
- wa = prefix_underscores_count(sym_name(sa));
- wb = prefix_underscores_count(sym_name(sb));
+ wa = strspn(sym_name(sa), "_");
+ wb = strspn(sym_name(sb), "_");
if (wa != wb)
return wa - wb;