diff options
author | Frank Gevaerts <frank@gevaerts.be> | 2009-03-09 22:04:40 +0000 |
---|---|---|
committer | Frank Gevaerts <frank@gevaerts.be> | 2009-03-09 22:04:40 +0000 |
commit | babda88228b629ecff3c748768c6660ecd9cc359 (patch) | |
tree | 7ef116a625a7eae6e29d90ff046fa778167e4201 /firmware | |
parent | efe3ec86f11d07ab1b1e152b1927b62cd4fc437f (diff) |
Make strnatcmp() and strnatcasecmp() call strcmp() or strcasecmp() if strings otherwise sort the same. This is done to make sure that strings always sort the same.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20265 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/common/strnatcmp.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/firmware/common/strnatcmp.c b/firmware/common/strnatcmp.c index 4cc3065978..d7ac60414f 100644 --- a/firmware/common/strnatcmp.c +++ b/firmware/common/strnatcmp.c @@ -130,9 +130,12 @@ static int strnatcmp0(char const *a, char const *b, int fold_case) } if (!ca && !cb) { - /* The strings compare the same. Perhaps the caller - will want to call strcmp to break the tie. */ - return 0; + /* The strings compare the same. Call str[case]cmp() to ensure + consistent results. */ + if(fold_case) + return strcasecmp(a,b); + else + return strcmp(a,b); } if (fold_case) { |