mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
implement SE 184: add allocation methods to Unsafe buffer pointers, drop all parameters from deallocation, adjust namings, and add repeated-value assignment methods
This commit is contained in:
committed by
Andrew Trick
parent
c7d33e70d3
commit
c85880899d
@@ -137,7 +137,7 @@ public final class _DataStorage {
|
||||
}
|
||||
return try apply(UnsafeRawBufferPointer(start: d.bytes.advanced(by: range.lowerBound - _offset), count: Swift.min(range.count, len)))
|
||||
} else {
|
||||
var buffer = UnsafeMutableRawBufferPointer.allocate(count: range.count)
|
||||
var buffer = UnsafeMutableRawBufferPointer.allocate(byteCount: range.count, alignment: MemoryLayout<UInt>.alignment)
|
||||
defer { buffer.deallocate() }
|
||||
let sliceRange = NSRange(location: range.lowerBound - _offset, length: range.count)
|
||||
var enumerated = 0
|
||||
@@ -168,7 +168,7 @@ public final class _DataStorage {
|
||||
}
|
||||
return try apply(UnsafeRawBufferPointer(start: d.bytes.advanced(by: range.lowerBound - _offset), count: Swift.min(range.count, len)))
|
||||
} else {
|
||||
var buffer = UnsafeMutableRawBufferPointer.allocate(count: range.count)
|
||||
var buffer = UnsafeMutableRawBufferPointer.allocate(byteCount: range.count, alignment: MemoryLayout<UInt>.alignment)
|
||||
defer { buffer.deallocate() }
|
||||
let sliceRange = NSRange(location: range.lowerBound - _offset, length: range.count)
|
||||
var enumerated = 0
|
||||
|
||||
Reference in New Issue
Block a user