@@ -45,7 +45,7 @@ public class ManagedProtoBuffer<Value, Element> : NonObjectiveCBase {
45
45
/// - Note: This pointer is only valid for the duration of the
46
46
/// call to `body`.
47
47
public final func withUnsafeMutablePointerToValue< R> (
48
- _ body: ( UnsafeMutablePointer < Value > ) -> R
48
+ _ body: @ noescape ( UnsafeMutablePointer < Value > ) -> R
49
49
) -> R {
50
50
return withUnsafeMutablePointers { ( v, e) in return body ( v) }
51
51
}
@@ -56,7 +56,7 @@ public class ManagedProtoBuffer<Value, Element> : NonObjectiveCBase {
56
56
/// - Note: This pointer is only valid for the duration of the
57
57
/// call to `body`.
58
58
public final func withUnsafeMutablePointerToElements< R> (
59
- _ body: ( UnsafeMutablePointer < Element > ) -> R
59
+ _ body: @ noescape ( UnsafeMutablePointer < Element > ) -> R
60
60
) -> R {
61
61
return withUnsafeMutablePointers { return body ( $0. 1 ) }
62
62
}
@@ -67,7 +67,7 @@ public class ManagedProtoBuffer<Value, Element> : NonObjectiveCBase {
67
67
/// - Note: These pointers are only valid for the duration of the
68
68
/// call to `body`.
69
69
public final func withUnsafeMutablePointers< R> (
70
- _ body: ( _ : UnsafeMutablePointer < Value > , _ : UnsafeMutablePointer < Element > ) -> R
70
+ _ body: @ noescape ( UnsafeMutablePointer < Value > , UnsafeMutablePointer < Element > ) -> R
71
71
) -> R {
72
72
return ManagedBufferPointer ( self ) . withUnsafeMutablePointers ( body)
73
73
}
@@ -99,7 +99,7 @@ public class ManagedBuffer<Value, Element>
99
99
/// generate an initial `Value`.
100
100
public final class func create(
101
101
minimumCapacity: Int ,
102
- initialValue: ( ManagedProtoBuffer < Value , Element > ) -> Value
102
+ initialValue: @ noescape ( ManagedProtoBuffer < Value , Element > ) -> Value
103
103
) -> ManagedBuffer < Value , Element > {
104
104
105
105
let p = ManagedBufferPointer < Value , Element > (
@@ -185,7 +185,7 @@ public struct ManagedBufferPointer<Value, Element> : Equatable {
185
185
public init (
186
186
bufferClass: AnyClass ,
187
187
minimumCapacity: Int ,
188
- initialValue: ( buffer: AnyObject , capacity: ( AnyObject ) -> Int ) -> Value
188
+ initialValue: @ noescape ( buffer: AnyObject , capacity: @ noescape ( AnyObject ) -> Int ) -> Value
189
189
) {
190
190
self = ManagedBufferPointer ( bufferClass: bufferClass, minimumCapacity: minimumCapacity)
191
191
@@ -268,7 +268,7 @@ public struct ManagedBufferPointer<Value, Element> : Equatable {
268
268
/// - Note: This pointer is only valid for the duration of the
269
269
/// call to `body`.
270
270
public func withUnsafeMutablePointerToElements< R> (
271
- _ body: ( UnsafeMutablePointer < Element > ) -> R
271
+ _ body: @ noescape ( UnsafeMutablePointer < Element > ) -> R
272
272
) -> R {
273
273
return withUnsafeMutablePointers { return body ( $0. 1 ) }
274
274
}
@@ -279,11 +279,10 @@ public struct ManagedBufferPointer<Value, Element> : Equatable {
279
279
/// - Note: These pointers are only valid for the duration of the
280
280
/// call to `body`.
281
281
public func withUnsafeMutablePointers< R> (
282
- _ body: @noescape ( _ : UnsafeMutablePointer < Value > , _ : UnsafeMutablePointer < Element > ) -> R
282
+ _ body: @noescape ( UnsafeMutablePointer < Value > , UnsafeMutablePointer < Element > ) -> R
283
283
) -> R {
284
- let result = body ( _valuePointer, _elementPointer)
285
- _fixLifetime ( _nativeBuffer)
286
- return result
284
+ defer { _fixLifetime ( _nativeBuffer) }
285
+ return body ( _valuePointer, _elementPointer)
287
286
}
288
287
289
288
/// Returns `true` iff `self` holds the only strong reference to its buffer.
0 commit comments