@@ -420,7 +420,7 @@ static UCollator *__CFStringCopyDefaultCollator(CFLocaleRef compareLocale) {
420
420
return collator ;
421
421
}
422
422
423
- #if TARGET_OS_MAC
423
+ #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
424
424
static void __collatorFinalize (UCollator * collator ) {
425
425
CFLocaleRef locale = _CFGetTSD (__CFTSDKeyCollatorLocale );
426
426
_CFSetTSD (__CFTSDKeyCollatorUCollator , NULL , NULL );
@@ -603,28 +603,24 @@ CF_PRIVATE CFComparisonResult _CFCompareStringsWithLocale(CFStringInlineBuffer *
603
603
if (range2 .location > 0 ) {
604
604
range2 .location = __extendLocationBackward (range2 .location - 1 , str2 , nonBaseBMP , punctBMP );
605
605
}
606
-
606
+
607
607
#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
608
- #if TARGET_OS_MAC
609
608
// First we try to use the last one used on this thread, if the locale is the same,
610
609
// otherwise we try to check out a default one, or then we create one.
611
610
UCollator * threadCollator = _CFGetTSD (__CFTSDKeyCollatorUCollator );
612
611
CFLocaleRef threadLocale = _CFGetTSD (__CFTSDKeyCollatorLocale );
613
612
if (compareLocale == threadLocale ) {
614
613
collator = threadCollator ;
615
614
} else {
616
- #endif
617
615
collator = __CFStringCopyDefaultCollator ((CFLocaleRef )compareLocale );
618
616
defaultCollator = true;
619
617
if (NULL == collator ) {
620
618
collator = __CFStringCreateCollator ((CFLocaleRef )compareLocale );
621
619
defaultCollator = false;
622
620
}
623
- #if TARGET_OS_MAC
624
621
}
625
622
#endif
626
- #endif
627
-
623
+
628
624
characters1 = CFStringGetCharactersPtrFromInlineBuffer (str1 , range1 );
629
625
characters2 = CFStringGetCharactersPtrFromInlineBuffer (str2 , range2 );
630
626
@@ -739,7 +735,7 @@ CF_PRIVATE CFComparisonResult _CFCompareStringsWithLocale(CFStringInlineBuffer *
739
735
if (buffer2Len > 0 ) CFAllocatorDeallocate (kCFAllocatorSystemDefault , buffer2 );
740
736
}
741
737
742
- #if TARGET_OS_MAC
738
+ #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
743
739
if (collator == threadCollator ) {
744
740
// do nothing, already cached
745
741
} else {
0 commit comments