Revert "Fixes crash when DispatchData is created from an UnsafeBufferPointer<Uint8> with a nil address."
This reverts commit 86860b50fc8467cd8028f3581e3a55512bfed74e (fix should have been made in a branch)
diff --git a/src/swift/Data.swift b/src/swift/Data.swift
index e0647e7..d51205c 100644
--- a/src/swift/Data.swift
+++ b/src/swift/Data.swift
@@ -50,9 +50,7 @@
///
/// - parameter bytes: A pointer to the memory. It will be copied.
public init(bytes buffer: UnsafeBufferPointer<UInt8>) {
- let d = buffer.baseAddress == nil ? _swift_dispatch_data_empty()
- : dispatch_data_create(buffer.baseAddress!, buffer.count, nil,
- _dispatch_data_destructor_default())
+ let d = dispatch_data_create(buffer.baseAddress!, buffer.count, nil, _dispatch_data_destructor_default())
self.init(data: d)
}
@@ -62,8 +60,7 @@
/// - parameter deallocator: Specifies the mechanism to free the indicated buffer.
public init(bytesNoCopy bytes: UnsafeBufferPointer<UInt8>, deallocator: Deallocator = .free) {
let (q, b) = deallocator._deallocator
- let d = bytes.baseAddress == nil ? _swift_dispatch_data_empty()
- : dispatch_data_create(bytes.baseAddress!, bytes.count, q?.__wrapped, b)
+ let d = dispatch_data_create(bytes.baseAddress!, bytes.count, q?.__wrapped, b)
self.init(data: d)
}