mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[stdlib] Kill off _isUniquelyReferenced
It was doing an unsafeBitCast and possibly not managing lifetimes; replace it with more-typesafe and memory-safe calls where possible. Swift SVN r22779
This commit is contained in:
@@ -151,7 +151,7 @@ extension _ArrayBuffer {
|
||||
|
||||
/// Return true iff this buffer's storage is uniquely-referenced.
|
||||
mutating func isUniquelyReferenced() -> Bool {
|
||||
return Swift._isUniquelyReferenced(&storage)
|
||||
return _isUniquelyReferenced_native(&storage)
|
||||
}
|
||||
|
||||
/// Convert to an NSArray.
|
||||
@@ -180,7 +180,7 @@ extension _ArrayBuffer {
|
||||
mutating func requestUniqueMutableBackingBuffer(minimumCapacity: Int)
|
||||
-> NativeBuffer?
|
||||
{
|
||||
if _fastPath(Swift._isUniquelyReferenced(&storage) && _hasMutableBuffer) {
|
||||
if _fastPath(isUniquelyReferenced() && _hasMutableBuffer) {
|
||||
let b = _native
|
||||
if _fastPath(b.capacity >= minimumCapacity) {
|
||||
return b
|
||||
@@ -191,7 +191,7 @@ extension _ArrayBuffer {
|
||||
|
||||
public
|
||||
mutating func isMutableAndUniquelyReferenced() -> Bool {
|
||||
return Swift._isUniquelyReferenced(&storage) && _hasMutableBuffer
|
||||
return isUniquelyReferenced() && _hasMutableBuffer
|
||||
}
|
||||
|
||||
/// If this buffer is backed by a `_ContiguousArrayBuffer`
|
||||
|
||||
Reference in New Issue
Block a user