improved comparing tree name strings when sorting tree
authorHolger Schemel <info@artsoft.org>
Fri, 5 Feb 2021 16:40:20 +0000 (17:40 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 5 Feb 2021 16:40:20 +0000 (17:40 +0100)
src/libgame/setup.c

index e223a0b84bb2b66992746dbe8c6375d299016341..af90c247d4a14c9031a8e3b6f6c56bb2a8c5a20e 100644 (file)
@@ -2878,15 +2878,7 @@ static int compareTreeInfoEntries(const void *object1, const void *object2)
   if (entry1->parent_link || entry2->parent_link)
     compare_result = (entry1->parent_link ? -1 : +1);
   else if (entry1->sort_priority == entry2->sort_priority)
   if (entry1->parent_link || entry2->parent_link)
     compare_result = (entry1->parent_link ? -1 : +1);
   else if (entry1->sort_priority == entry2->sort_priority)
-  {
-    char *name1 = getStringToLower(entry1->name_sorting);
-    char *name2 = getStringToLower(entry2->name_sorting);
-
-    compare_result = strcmp(name1, name2);
-
-    free(name1);
-    free(name2);
-  }
+    compare_result = strcasecmp(entry1->name_sorting, entry2->name_sorting);
   else if (class_sorting1 == class_sorting2)
     compare_result = entry1->sort_priority - entry2->sort_priority;
   else
   else if (class_sorting1 == class_sorting2)
     compare_result = entry1->sort_priority - entry2->sort_priority;
   else