Skip to content

Commit 805ac48

Browse files
authored
Merge pull request #2655 from spevans/pr_sr_11917
2 parents 7d0f3ea + 1112582 commit 805ac48

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

CoreFoundation/String.subproj/CFStringUtilities.c

+4-8
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ static UCollator *__CFStringCopyDefaultCollator(CFLocaleRef compareLocale) {
420420
return collator;
421421
}
422422

423-
#if TARGET_OS_MAC
423+
#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
424424
static void __collatorFinalize(UCollator *collator) {
425425
CFLocaleRef locale = _CFGetTSD(__CFTSDKeyCollatorLocale);
426426
_CFSetTSD(__CFTSDKeyCollatorUCollator, NULL, NULL);
@@ -603,28 +603,24 @@ CF_PRIVATE CFComparisonResult _CFCompareStringsWithLocale(CFStringInlineBuffer *
603603
if (range2.location > 0) {
604604
range2.location = __extendLocationBackward(range2.location - 1, str2, nonBaseBMP, punctBMP);
605605
}
606-
606+
607607
#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
608-
#if TARGET_OS_MAC
609608
// First we try to use the last one used on this thread, if the locale is the same,
610609
// otherwise we try to check out a default one, or then we create one.
611610
UCollator *threadCollator = _CFGetTSD(__CFTSDKeyCollatorUCollator);
612611
CFLocaleRef threadLocale = _CFGetTSD(__CFTSDKeyCollatorLocale);
613612
if (compareLocale == threadLocale) {
614613
collator = threadCollator;
615614
} else {
616-
#endif
617615
collator = __CFStringCopyDefaultCollator((CFLocaleRef)compareLocale);
618616
defaultCollator = true;
619617
if (NULL == collator) {
620618
collator = __CFStringCreateCollator((CFLocaleRef)compareLocale);
621619
defaultCollator = false;
622620
}
623-
#if TARGET_OS_MAC
624621
}
625622
#endif
626-
#endif
627-
623+
628624
characters1 = CFStringGetCharactersPtrFromInlineBuffer(str1, range1);
629625
characters2 = CFStringGetCharactersPtrFromInlineBuffer(str2, range2);
630626

@@ -739,7 +735,7 @@ CF_PRIVATE CFComparisonResult _CFCompareStringsWithLocale(CFStringInlineBuffer *
739735
if (buffer2Len > 0) CFAllocatorDeallocate(kCFAllocatorSystemDefault, buffer2);
740736
}
741737

742-
#if TARGET_OS_MAC
738+
#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
743739
if (collator == threadCollator) {
744740
// do nothing, already cached
745741
} else {

0 commit comments

Comments
 (0)