Skip to content

Commit 8730f2c

Browse files
committed
[gardening] 80-column enforcement
1 parent 65693b8 commit 8730f2c

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

Sources/System/MachPort.swift

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ public enum Mach {
4848
///
4949
/// This initializer makes a syscall to guard the right.
5050
public init(name: mach_port_name_t) {
51-
precondition(name != mach_port_name_t(MACH_PORT_NULL), "Mach.Port cannot be initialized with MACH_PORT_NULL")
51+
precondition(name != mach_port_name_t(MACH_PORT_NULL),
52+
"Mach.Port cannot be initialized with MACH_PORT_NULL")
5253
self._name = name
5354

5455
if RightType.self == ReceiveRight.self {
55-
precondition(name != 0xFFFFFFFF /* MACH_PORT_DEAD */, "Receive rights cannot be dead names")
56+
precondition(name != 0xFFFFFFFF /* MACH_PORT_DEAD */,
57+
"Receive rights cannot be dead names")
5658

5759
let secret = mach_port_context_t(arc4random())
5860
_machPrecondition(mach_port_guard(mach_task_self_, name, secret, 0))
@@ -82,7 +84,8 @@ public enum Mach {
8284

8385
deinit {
8486
if RightType.self == ReceiveRight.self {
85-
precondition(_name != 0xffffffff, "Receive rights cannot be dead names")
87+
precondition(_name != 0xFFFFFFFF /* MACH_PORT_DEAD */,
88+
"Receive rights cannot be dead names")
8689
_machPrecondition(
8790
mach_port_destruct(mach_task_self_, _name, 0, _context)
8891
)
@@ -135,7 +138,8 @@ extension Mach.Port where RightType == Mach.ReceiveRight {
135138
/// The underlying port right will be automatically deallocated when
136139
/// the Mach.Port object is destroyed.
137140
public init(name: mach_port_name_t, context: mach_port_context_t) {
138-
precondition(name != mach_port_name_t(MACH_PORT_NULL), "Mach.Port cannot be initialized with MACH_PORT_NULL")
141+
precondition(name != mach_port_name_t(MACH_PORT_NULL),
142+
"Mach.Port cannot be initialized with MACH_PORT_NULL")
139143
self._name = name
140144
self._context = context
141145
}
@@ -251,7 +255,11 @@ extension Mach.Port where RightType == Mach.ReceiveRight {
251255
let how = MACH_MSG_TYPE_MAKE_SEND
252256

253257
// name is the same because send and recv rights are coalesced
254-
_machPrecondition(mach_port_insert_right(mach_task_self_, _name, _name, mach_msg_type_name_t(how)))
258+
_machPrecondition(
259+
mach_port_insert_right(
260+
mach_task_self_, _name, _name, mach_msg_type_name_t(how)
261+
)
262+
)
255263

256264
return Mach.Port(name: _name)
257265
}
@@ -316,7 +324,9 @@ extension Mach.Port where RightType == Mach.SendRight {
316324
let how = MACH_MSG_TYPE_COPY_SEND
317325

318326
// name is the same because send rights are coalesced
319-
let kr = mach_port_insert_right(mach_task_self_, _name, _name, mach_msg_type_name_t(how))
327+
let kr = mach_port_insert_right(
328+
mach_task_self_, _name, _name, mach_msg_type_name_t(how)
329+
)
320330
if kr == KERN_INVALID_NAME || kr == KERN_INVALID_CAPABILITY {
321331
throw Mach.PortRightError.deadName
322332
}

0 commit comments

Comments
 (0)