projects
/
project
/
ubox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
kmodloader: fix not being able to find some modules
[project/ubox.git]
/
kmodloader.c
diff --git
a/kmodloader.c
b/kmodloader.c
index 465d3de84206337d7f18799c93d7e3a15ba90090..ac14bacaa0916fffcbee415d5ef8743cda6d772c 100644
(file)
--- a/
kmodloader.c
+++ b/
kmodloader.c
@@
-985,20
+985,23
@@
out:
return 0;
}
return 0;
}
+static inline char weight(char c)
+{
+ return c == '_' ? '-' : c;
+}
+
static int avl_modcmp(const void *k1, const void *k2, void *ptr)
{
const char *s1 = k1;
const char *s2 = k2;
static int avl_modcmp(const void *k1, const void *k2, void *ptr)
{
const char *s1 = k1;
const char *s2 = k2;
- while (*s1 && ((*s1 == *s2) ||
- ((*s1 == '_') && (*s2 == '-')) ||
- ((*s1 == '-') && (*s2 == '_'))))
+ while (*s1 && (weight(*s1) == weight(*s2)))
{
s1++;
s2++;
}
{
s1++;
s2++;
}
- return
*(const unsigned char *)s1 - *(const unsigned char *)s2
;
+ return
(unsigned char)weight(*s1) - (unsigned char)weight(*s2)
;
}
int main(int argc, char **argv)
}
int main(int argc, char **argv)