From 6148a25bed9c3b10f65bbad020f31ddd9222ebf9 Mon Sep 17 00:00:00 2001 From: Johannes Weiss Date: Mon, 27 Jan 2025 22:02:48 +0000 Subject: [PATCH] undo Xcode 13 GM workaround --- Sources/NIOCore/ByteBuffer-core.swift | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Sources/NIOCore/ByteBuffer-core.swift b/Sources/NIOCore/ByteBuffer-core.swift index 812a8cc3863..cc53d97f714 100644 --- a/Sources/NIOCore/ByteBuffer-core.swift +++ b/Sources/NIOCore/ByteBuffer-core.swift @@ -31,11 +31,10 @@ import WASILibc @usableFromInline let sysMalloc: @convention(c) (size_t) -> UnsafeMutableRawPointer? = malloc @usableFromInline let sysRealloc: @convention(c) (UnsafeMutableRawPointer?, size_t) -> UnsafeMutableRawPointer? = realloc - -/// Xcode 13 GM shipped with a bug in the SDK that caused `free`'s first argument to be annotated as -/// non-nullable. To that end, we define a thunk through to `free` that matches that constraint, as we -/// never pass a `nil` pointer to it. -@usableFromInline let sysFree: @convention(c) (UnsafeMutableRawPointer) -> Void = { free($0) } +@inlinable +func sysFree(_ ptr: UnsafeMutableRawPointer) { + free(ptr) +} extension _ByteBufferSlice: Equatable {}