Commit aa915245 authored by Masahiro Yamada's avatar Masahiro Yamada

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 29e55ad3
...@@ -661,16 +661,6 @@ static int may_be_linker_script_provide_symbol(const struct sym_entry *se) ...@@ -661,16 +661,6 @@ static int may_be_linker_script_provide_symbol(const struct sym_entry *se)
return 0; 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) static int compare_symbols(const void *a, const void *b)
{ {
const struct sym_entry *sa; const struct sym_entry *sa;
...@@ -699,8 +689,8 @@ static int compare_symbols(const void *a, const void *b) ...@@ -699,8 +689,8 @@ static int compare_symbols(const void *a, const void *b)
return wa - wb; return wa - wb;
/* sort by the number of prefix underscores */ /* sort by the number of prefix underscores */
wa = prefix_underscores_count(sym_name(sa)); wa = strspn(sym_name(sa), "_");
wb = prefix_underscores_count(sym_name(sb)); wb = strspn(sym_name(sb), "_");
if (wa != wb) if (wa != wb)
return wa - wb; return wa - wb;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment