Storage should be initialized to MACH_PORT_NULL, rather than 0

This commit is contained in:
Daniel Loffgren committed 2022-12-20 15:45:17 -08:00
1 parent 4536c47763
commit bd036acda6
1 file changed
+1 -1
+1 -1
View File
@@ -145,7 +145,7 @@ extension Mach.Port where RightType == Mach.ReceiveRight {
/// This initializer will abort if the right could not be created.
/// Callers may assert that a valid right is always returned.
init() {
var storage: mach_port_name_t = 0
var storage: mach_port_name_t = mach_port_name_t(MACH_PORT_NULL)
withUnsafeMutablePointer(to: &storage) { storage in
machPrecondition(mach_port_allocate(mach_task_self_, MACH_PORT_RIGHT_RECEIVE, storage))
}