Skip to content

Commit bae68a5

Browse files
committed
Use C type in typealias
1 parent b6558a3 commit bae68a5

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

Sources/System/Platform/Platform.swift

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,21 @@
1414
@available(*, deprecated, renamed: "CInterop.Mode")
1515
public typealias CModeT = CInterop.Mode
1616

17+
import CSystem
18+
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
19+
import Darwin
20+
#elseif os(Linux) || os(FreeBSD) || os(Android)
21+
import Glibc
22+
#elseif os(Windows)
23+
import ucrt
24+
#else
25+
#error("Unsupported Platform")
26+
#endif
27+
1728
/// A namespace for C and platform types
1829
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1930
public enum CInterop {
20-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
21-
/// The C `mode_t` type.
22-
public typealias Mode = UInt16
23-
#elseif os(Windows)
24-
/// The C `mode_t` type.
25-
public typealias Mode = Int32
26-
#else
27-
/// The C `mode_t` type.
28-
public typealias Mode = UInt32
29-
#endif
31+
public typealias Mode = mode_t
3032

3133
/// The C `char` type
3234
public typealias Char = CChar

0 commit comments

Comments
 (0)