[Bf-blender-cvs] [0f3b910c3a6] master: Cleanup: redundant lowercase in BLI_natstrcmp

Campbell Barton noreply at git.blender.org
Fri Aug 30 18:41:45 CEST 2019


Commit: 0f3b910c3a69ab557508090ce1dad2ac051d3b00
Author: Campbell Barton
Date:   Sat Aug 31 02:40:34 2019 +1000
Branches: master
https://developer.blender.org/rB0f3b910c3a69ab557508090ce1dad2ac051d3b00

Cleanup: redundant lowercase in BLI_natstrcmp

===================================================================

M	source/blender/blenlib/intern/string.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list