Guard autoreleasepool with canImport(ObjectiveC) (#3782)

The `autoreleasepool` code only needs the `ObjectiveC` runtime, not
`Darwin`.
This commit is contained in:
Franz Busch authored and GitHub committed 2026-11-09 10:17:46 +01:00
1 parent 02d6d9ada2
commit b440f7bae8
1 file changed
+5 -1
+5 -1
View File
@@ -22,6 +22,10 @@ import NIOConcurrencyHelpers
import NIOCore
import _NIODataStructures
#if canImport(ObjectiveC)
import ObjectiveC
#endif
private func printError(_ string: StaticString) {
string.withUTF8Buffer { buf in
var buf = buf
@@ -41,7 +45,7 @@ private func printError(_ string: StaticString) {
/// Execute the given closure and ensure we release all auto pools if needed.
@inlinable
internal func withAutoReleasePool<T>(_ execute: () throws -> T) rethrows -> T {
#if canImport(Darwin)
#if canImport(ObjectiveC)
return try autoreleasepool {
try execute()
}