Skip to content

Commit 1a27fdd

Browse files
authored
Merge pull request #452 from atrick/rawptr-initfrom
Update for SE-0107, rename initializeFrom.
2 parents 1d26dfd + 3f673b4 commit 1a27fdd

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

Foundation/NSArray.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NS
159159
// }
160160
let cnt = array.count
161161
let buffer = UnsafeMutablePointer<AnyObject?>(allocatingCapacity: cnt)
162-
buffer.initializeFrom(optionalArray)
162+
buffer.initialize(from: optionalArray)
163163
self.init(objects: buffer, count: cnt)
164164
buffer.deinitialize(count: cnt)
165165
buffer.deallocateCapacity(cnt)

Foundation/NSConcreteValue.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ internal class NSConcreteValue : NSValue {
9292
self._typeInfo = typeInfo!
9393

9494
self._storage = UnsafeMutablePointer<UInt8>(allocatingCapacity: self._typeInfo.size)
95-
self._storage.initializeFrom(unsafeBitCast(value, to: UnsafeMutablePointer<UInt8>.self), count: self._typeInfo.size)
95+
self._storage.initialize(from: unsafeBitCast(value, to: UnsafeMutablePointer<UInt8>.self), count: self._typeInfo.size)
9696
}
9797

9898
deinit {
@@ -101,7 +101,7 @@ internal class NSConcreteValue : NSValue {
101101
}
102102

103103
override func getValue(_ value: UnsafeMutablePointer<Void>) {
104-
UnsafeMutablePointer<UInt8>(value).moveInitializeFrom(unsafeBitCast(self._storage, to: UnsafeMutablePointer<UInt8>.self), count: self._size)
104+
UnsafeMutablePointer<UInt8>(value).moveInitialize(from: unsafeBitCast(self._storage, to: UnsafeMutablePointer<UInt8>.self), count: self._size)
105105
}
106106

107107
override var objCType : UnsafePointer<Int8> {

Foundation/NSDictionary.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ public class NSDictionary : NSObject, NSCopying, NSMutableCopying, NSSecureCodin
227227

228228
public convenience init(objects: [AnyObject], forKeys keys: [NSObject]) {
229229
let keyBuffer = UnsafeMutablePointer<NSObject>(allocatingCapacity: keys.count)
230-
keyBuffer.initializeFrom(keys)
230+
keyBuffer.initialize(from: keys)
231231

232232
let valueBuffer = UnsafeMutablePointer<AnyObject>(allocatingCapacity: objects.count)
233-
valueBuffer.initializeFrom(objects)
233+
valueBuffer.initialize(from: objects)
234234

235235
self.init(objects: valueBuffer, forKeys:keyBuffer, count: keys.count)
236236

Foundation/NSKeyedCoderOldStyleArray.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ internal final class _NSKeyedCoderOldStyleArray : NSObject, NSCopying, NSSecureC
9494

9595
func fillObjCType(_ type: _NSSimpleObjCType, count: Int, at addr: UnsafeMutablePointer<Void>) {
9696
if type == self._type && count <= self._count {
97-
UnsafeMutablePointer<UInt8>(addr).moveInitializeFrom(self._addr, count: count * self._size)
97+
UnsafeMutablePointer<UInt8>(addr).moveInitialize(from: self._addr, count: count * self._size)
9898
}
9999
}
100100

Foundation/NSString.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ extension NSString {
882882
if self.dynamicType == NSString.self || self.dynamicType == NSMutableString.self {
883883
if _storage._core.isASCII {
884884
used = min(self.length, maxBufferCount - 1)
885-
buffer.moveAssignFrom(unsafeBitCast(_storage._core.startASCII, to: UnsafeMutablePointer<Int8>.self)
885+
buffer.moveAssign(from: unsafeBitCast(_storage._core.startASCII, to: UnsafeMutablePointer<Int8>.self)
886886
, count: used)
887887
buffer.advanced(by: used).initialize(with: 0)
888888
return true

Foundation/NSTask.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public class Task: NSObject {
205205
let argv : UnsafeMutablePointer<UnsafeMutablePointer<Int8>?> = args.withUnsafeBufferPointer {
206206
let array : UnsafeBufferPointer<String> = $0
207207
let buffer = UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>(allocatingCapacity: array.count + 1)
208-
buffer.initializeFrom(array.map { $0.withCString(strdup) })
208+
buffer.initialize(from: array.map { $0.withCString(strdup) })
209209
buffer[array.count] = nil
210210
return buffer
211211
}
@@ -223,7 +223,7 @@ public class Task: NSObject {
223223
if let env = environment {
224224
let nenv = env.count
225225
envp = UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>(allocatingCapacity: 1 + nenv)
226-
envp.initializeFrom(env.map { strdup("\($0)=\($1)") })
226+
envp.initialize(from: env.map { strdup("\($0)=\($1)") })
227227
envp[env.count] = nil
228228
} else {
229229
envp = _CFEnviron()

0 commit comments

Comments
 (0)