Add: [OSX] Native natural sort implementation.

This commit is contained in:
Michael Lutz
2018-09-23 19:26:09 +02:00
parent 05a93c121c
commit 8d7cd6a526
5 changed files with 101 additions and 0 deletions

View File

@@ -33,6 +33,10 @@
#include "os/windows/string_uniscribe.h"
#endif
#if defined(WITH_COCOA)
#include "os/macosx/string_osx.h"
#endif
#ifdef WITH_ICU_SORT
/* Required by strnatcmp. */
#include <unicode/ustring.h>
@@ -593,6 +597,11 @@ int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front)
if (res != 0) return res - 2; // Convert to normal C return values.
#endif
#if defined(WITH_COCOA) && !defined(STRGEN) && !defined(SETTINGSGEN)
int res = MacOSStringCompare(s1, s2);
if (res != 0) return res - 2; // Convert to normal C return values.
#endif
/* Do a normal comparison if ICU is missing or if we cannot create a collator. */
return strcasecmp(s1, s2);
}