diff options
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/string.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 3b69e257f45..c3947cb8158 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -675,10 +675,7 @@ int BLI_natstrcmp(const char *s1, const char *s2) * numeric, else do a tolower and char compare */ while (1) { - c1 = tolower(s1[d1]); - c2 = tolower(s2[d2]); - - if (isdigit(c1) && isdigit(c2)) { + if (isdigit(s1[d1]) && isdigit(s2[d2])) { int numcompare = left_number_strcmp(s1 + d1, s2 + d2, &tiebreaker); if (numcompare != 0) { @@ -693,11 +690,11 @@ int BLI_natstrcmp(const char *s1, const char *s2) while (isdigit(s2[d2])) { d2++; } - - c1 = tolower(s1[d1]); - c2 = tolower(s2[d2]); } + c1 = tolower(s1[d1]); + c2 = tolower(s2[d2]); + /* first check for '.' so "foo.bar" comes before "foo 1.bar" */ if (c1 == '.' && c2 != '.') { return -1; |