Skip to content

Commit 9c48a80

Browse files
Merge pull request #385 from ktopley-apple/ktopley-dispatch-rdar40775762
Change the signature for DispatchData.enumerateBytes() to match that …
2 parents ba3933d + fcf1d5e commit 9c48a80

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/swift/Data.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,22 @@ public struct DispatchData : RandomAccessCollection {
117117
return try body(contentPtr)
118118
}
119119

120+
@available(swift 4.2)
121+
public func enumerateBytes(
122+
_ block: (_ buffer: UnsafeBufferPointer<UInt8>, _ byteIndex: Int, _ stop: inout Bool) -> Void)
123+
{
124+
enumerateBytesCommon(block)
125+
}
126+
127+
@available(swift, obsoleted: 4.2, renamed: "enumerateBytes(_:)")
120128
public func enumerateBytes(
121129
block: (_ buffer: UnsafeBufferPointer<UInt8>, _ byteIndex: Int, _ stop: inout Bool) -> Void)
130+
{
131+
enumerateBytesCommon(block)
132+
}
133+
134+
private func enumerateBytesCommon(
135+
_ block: (_ buffer: UnsafeBufferPointer<UInt8>, _ byteIndex: Int, _ stop: inout Bool) -> Void)
122136
{
123137
// we know that capturing block in the closure being created/passed to dispatch_data_apply
124138
// does not cause block to escape because dispatch_data_apply does not allow its

0 commit comments

Comments
 (0)