Skip to content

Commit 22af71d

Browse files
authored
Move __CFAllocatorRespectsHintZeroWhenAllocating to a CF-internal header to avoid confusion over its linkage. Resolves swiftlang#5125 (swiftlang#5126) (swiftlang#5127)
(cherry picked from commit b1b4603)
1 parent cc817e4 commit 22af71d

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

Sources/CoreFoundation/CFBase.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ void *__CFSafelyReallocateWithAllocator(CFAllocatorRef allocator, void *destinat
790790
return _CLANG_ANALYZER_IGNORE_NONNULL(reallocated);;
791791
}
792792

793-
Boolean __CFAllocatorRespectsHintZeroWhenAllocating(CFAllocatorRef allocator) {
793+
CF_PRIVATE Boolean __CFAllocatorRespectsHintZeroWhenAllocating(CFAllocatorRef allocator) {
794794
return allocator == kCFAllocatorSystemDefault || allocator == kCFAllocatorMallocZone;
795795
}
796796

Sources/CoreFoundation/include/ForFoundationOnly.h

-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ CF_EXPORT void *_Nonnull __CFSafelyReallocate(void * _Nullable destination, size
6868
CF_EXPORT void *_Nonnull __CFSafelyReallocateWithAllocator(CFAllocatorRef _Nullable, void * _Nullable destination, size_t newCapacity, CFOptionFlags options, void (^_Nullable reallocationFailureHandler)(void *_Nonnull original, bool *_Nonnull outRecovered));
6969
#endif
7070

71-
Boolean __CFAllocatorRespectsHintZeroWhenAllocating(CFAllocatorRef _Nullable allocator);
7271
typedef CF_ENUM(CFOptionFlags, _CFAllocatorHint) {
7372
_CFAllocatorHintZeroWhenAllocating = 1
7473
};

Sources/CoreFoundation/include/ForSwiftFoundationOnly.h

-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@
105105

106106
_CF_EXPORT_SCOPE_BEGIN
107107

108-
CF_PRIVATE Boolean __CFAllocatorRespectsHintZeroWhenAllocating(CFAllocatorRef _Nullable allocator);
109-
110108
struct __CFSwiftObject {
111109
uintptr_t isa;
112110
};

Sources/CoreFoundation/internalInclude/CFInternal.h

+2
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,8 @@ CF_INLINE CFAllocatorRef __CFGetAllocator(CFTypeRef cf) { // !!! Use with CF typ
10571057
return *(CFAllocatorRef *)((char *)cf - 16);
10581058
}
10591059

1060+
CF_PRIVATE Boolean __CFAllocatorRespectsHintZeroWhenAllocating(CFAllocatorRef allocator);
1061+
10601062
/* !!! Avoid #importing objc.h; e.g. converting this to a .m file */
10611063
struct __objcFastEnumerationStateEquivalent {
10621064
unsigned long state;

0 commit comments

Comments
 (0)