Skip to content

Commit

Permalink
Replace os() with canImport(Darwin) (#399)
Browse files Browse the repository at this point in the history
* Replace os() with canImport(Darwin)

* Removed compilation condition since it'll be always true

---------

Co-authored-by: Cory Benfield <lukasa@apple.com>
  • Loading branch information
o-nnerb and Lukasa committed Jun 23, 2023
1 parent 2d704c2 commit 87e96ed
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
13 changes: 0 additions & 13 deletions Sources/NIOHPACK/HuffmanCoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,6 @@ extension String {
}
}

// Frustratingly, Swift 5.3 shipped before the macOS 11 SDK did, so we cannot gate the availability of
// this declaration on having the 5.3 compiler. This has caused a number of build issues. While updating
// to newer Xcodes does work, we can save ourselves some hassle and just wait until 5.4 to get this
// enhancement on Apple platforms.
#if (compiler(>=5.3) && !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS))) || compiler(>=5.4)
extension String {
init(customUnsafeUninitializedCapacity capacity: Int,
initializingUTF8With initializer: (_ buffer: UnsafeMutableBufferPointer<UInt8>) throws -> Int) rethrows {
Expand All @@ -279,11 +274,3 @@ extension String {
}
}
}
#else
extension String {
init(customUnsafeUninitializedCapacity capacity: Int,
initializingUTF8With initializer: (_ buffer: UnsafeMutableBufferPointer<UInt8>) throws -> Int) rethrows {
try self.init(backportUnsafeUninitializedCapacity: capacity, initializingUTF8With: initializer)
}
}
#endif
2 changes: 1 addition & 1 deletion Tests/NIOHTTP2Tests/TestUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//

#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if canImport(Darwin)
import Darwin.C
#elseif os(Linux) || os(FreeBSD) || os(Android)
import Glibc
Expand Down

0 comments on commit 87e96ed

Please sign in to comment.