-
Notifications
You must be signed in to change notification settings - Fork 1.2k
The Ventura Core Foundation Merge #4633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci please test |
cc @parkera |
cc @compnerd - Similar to previous merges, can we kick off a Windows build to see if there's anything breaks? |
@iCharlesHu I thought this was the source compiled at Apple for macOS? |
char asciiBuf[CFMaxPathSize] = {0}; | ||
int res = WideCharToMultiByte(CP_UTF8, 0, buf, rlen, asciiBuf, sizeof(asciiBuf) / sizeof(asciiBuf[0]), NULL, NULL); | ||
if (0 < res) { | ||
char asciiBuf[CFMaxPathSize] = {0}; | ||
int res = WideCharToMultiByte(CP_UTF8, 0, buf, rlen, asciiBuf, sizeof(asciiBuf) / sizeof(asciiBuf[0]), NULL, NULL); | ||
if (0 < res) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is hard to judge because tabs are replaced with spaces, but indentation looks weird here and in some code below.
@@ -1367,7 +1383,7 @@ CF_PRIVATE Boolean _CFReadMappedFromFile(CFStringRef path, Boolean map, Boolean | |||
if (0LL == statBuf.st_size) { | |||
bytes = malloc(8); // don't return constant string -- it's freed! | |||
length = 0; | |||
#if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see major loss of code under TARGET_OS_WASI
and TARGET_OS_BSD
. Probably, @MaxDesiatov could point if those are important changes for Swift WASM support. And @3405691582 did most of effort for OpenBSD support.
@@ -451,290 +447,12 @@ CF_INLINE kern_return_t __CFPortSetRemove(__CFPort port, __CFPortSet portSet) { | |||
CF_INLINE void __CFPortSetFree(__CFPortSet portSet) { | |||
close(portSet); | |||
} | |||
#elif TARGET_OS_BSD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to add more finer grained review comments but I just did the needful anyway in #4648 -- feel free to pick those commits on this pr, since I don't know off the top of my head if I can chain prs. The comments about malloc introspection need to be addressed separately though, because it's not immediately apparent how to resolve that issue.
string = CFStringCreateMutableCopy(allocator, 0, string); | ||
CFRelease(tmp); | ||
} | ||
} else if (string && backingDataForNoCopy && malloc_size((void *)string) != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid unconditional malloc introspection. Can we safely ignore this branch if the platform doesn't support malloc_size
?
string = CFStringCreateMutableCopy(allocator, 0, string); | ||
CFRelease(tmp); | ||
} | ||
} else if (string && backingDataForNoCopy && malloc_size((void *)string) != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid unconditional malloc introspection. Can we safely ignore this branch if the platform doesn't support malloc_size
?
This PR brings the FOSS portions of Core Foundation on par with with macOS Ventura, iOS 16, watchOS 9 and tvOS 16. This includes the changes shipped during the previous releases.
Most of the changes include bug fixes and performance improvements, but some are useful to highlight:
CFString
andNSString
-based methods, including a new method of generating and storing this information by producing headers rather than bundling binary blobs.CFURLComponents
to support Internationalized Domain Names (IDNs) via Punycode encoding.Some development notes:
CF_CROSS_PLATFORM_EXPORT
has been renamed toCF_EXPORT_NONOBJC_ONLY
to make its use clearer.os_*_lock_*
functions rather thanCFLock
orCFMutex
. To avoid the codebase diverging too far and make future merges easier, this patch usesos_unfair_lock
and similar facilities where they were previously replaced byCFLock
. These types shim toCFLock
implementations outside of Darwin.