summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorYann E. MORIN <yann.morin.1998@free.fr>2013-07-13 15:09:43 +0200
committerYann E. MORIN <yann.morin.1998@free.fr>2013-07-16 20:26:46 +0200
commit26e933e3c35624d80281330c4beb17db4cd4960f (patch)
treeaf5f4cfbf5410eac6dec87cd4d314ba852d9bc9e /scripts
parentDocumentation/kconfig: more concise and straightforward search explanation (diff)
downloadlinux-26e933e3c35624d80281330c4beb17db4cd4960f.tar.xz
linux-26e933e3c35624d80281330c4beb17db4cd4960f.zip
kconfig: avoid multiple calls to strlen
Calls to strlen are costly, so avoid calling strln as much as we can. Reported-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Jean Delvare <jdelvare@suse.de> Reviewed-by: Jean Delvare <jdelvare@suse.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/symbol.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index d550300ec00c..020a0ac147e1 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -967,7 +967,7 @@ static int sym_rel_comp( const void *sym1, const void *sym2 )
{
struct sym_match *s1 = *(struct sym_match **)sym1;
struct sym_match *s2 = *(struct sym_match **)sym2;
- int l1, l2;
+ int exact1, exact2;
/* Exact match:
* - if matched length on symbol s1 is the length of that symbol,
@@ -978,11 +978,11 @@ static int sym_rel_comp( const void *sym1, const void *sym2 )
* exactly; if this is the case, we can't decide which comes first,
* and we fallback to sorting alphabetically.
*/
- l1 = s1->eo - s1->so;
- l2 = s2->eo - s2->so;
- if (l1 == strlen(s1->sym->name) && l2 != strlen(s2->sym->name))
+ exact1 = (s1->eo - s1->so) == strlen(s1->sym->name);
+ exact2 = (s2->eo - s2->so) == strlen(s2->sym->name);
+ if (exact1 && !exact2)
return -1;
- if (l1 != strlen(s1->sym->name) && l2 == strlen(s2->sym->name))
+ if (!exact1 && exact2)
return 1;
/* As a fallback, sort symbols alphabetically */