mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[noescape by default] drop @noescape from stdlib
This commit is contained in:
@@ -278,7 +278,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
|
||||
/// Access the bytes in the data.
|
||||
///
|
||||
/// - warning: The byte pointer argument should not be stored and used outside of the lifetime of the call to the closure.
|
||||
public func withUnsafeBytes<ResultType, ContentType>(_ body: @noescape (UnsafePointer<ContentType>) throws -> ResultType) rethrows -> ResultType {
|
||||
public func withUnsafeBytes<ResultType, ContentType>(_ body: (UnsafePointer<ContentType>) throws -> ResultType) rethrows -> ResultType {
|
||||
let bytes = _getUnsafeBytesPointer()
|
||||
defer { _fixLifetime(self)}
|
||||
let contentPtr = bytes.bindMemory(to: ContentType.self, capacity: count / MemoryLayout<ContentType>.stride)
|
||||
@@ -295,7 +295,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
|
||||
///
|
||||
/// This function assumes that you are mutating the contents.
|
||||
/// - warning: The byte pointer argument should not be stored and used outside of the lifetime of the call to the closure.
|
||||
public mutating func withUnsafeMutableBytes<ResultType, ContentType>(_ body: @noescape (UnsafeMutablePointer<ContentType>) throws -> ResultType) rethrows -> ResultType {
|
||||
public mutating func withUnsafeMutableBytes<ResultType, ContentType>(_ body: (UnsafeMutablePointer<ContentType>) throws -> ResultType) rethrows -> ResultType {
|
||||
let mutableBytes = _getUnsafeMutableBytesPointer()
|
||||
defer { _fixLifetime(self)}
|
||||
let contentPtr = mutableBytes.bindMemory(to: ContentType.self, capacity: count / MemoryLayout<ContentType>.stride)
|
||||
@@ -423,7 +423,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
|
||||
///
|
||||
/// In some cases, (for example, a `Data` backed by a `dispatch_data_t`, the bytes may be stored discontiguously. In those cases, this function invokes the closure for each contiguous region of bytes.
|
||||
/// - parameter block: The closure to invoke for each region of data. You may stop the enumeration by setting the `stop` parameter to `true`.
|
||||
public func enumerateBytes(_ block: @noescape (_ buffer: UnsafeBufferPointer<UInt8>, _ byteIndex: Index, _ stop: inout Bool) -> Void) {
|
||||
public func enumerateBytes(_ block: (_ buffer: UnsafeBufferPointer<UInt8>, _ byteIndex: Index, _ stop: inout Bool) -> Void) {
|
||||
_mapUnmanaged {
|
||||
$0.enumerateBytes { (ptr, range, stop) in
|
||||
var stopv = false
|
||||
@@ -820,7 +820,7 @@ extension _SwiftNSData {
|
||||
}
|
||||
|
||||
@objc(enumerateByteRangesUsingBlock:)
|
||||
func enumerateByteRanges(using block: @noescape (UnsafeRawPointer, NSRange, UnsafeMutablePointer<ObjCBool>) -> Void) {
|
||||
func enumerateByteRanges(using block: (UnsafeRawPointer, NSRange, UnsafeMutablePointer<ObjCBool>) -> Void) {
|
||||
return _mapUnmanaged { $0.enumerateBytes(block) }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user