Skip to content

Commit 5a2fd00

Browse files
authored
Merge pull request #31320 from valeriyvan/SnippetsUnsafeRawPointer
2 parents 3b44f10 + 5e3dd58 commit 5a2fd00

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

stdlib/public/core/UnsafeRawPointer.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ public struct UnsafeRawPointer: _Pointer {
288288
///
289289
/// let count = 4
290290
/// let bytesPointer = UnsafeMutableRawPointer.allocate(
291-
/// bytes: 100,
292-
/// alignedTo: MemoryLayout<Int8>.alignment)
291+
/// byteCount: 100,
292+
/// alignment: MemoryLayout<Int8>.alignment)
293293
/// let int8Pointer = bytesPointer.bindMemory(to: Int8.self, capacity: count)
294294
///
295295
/// After calling `bindMemory(to:capacity:)`, the first four bytes of the
@@ -653,8 +653,8 @@ public struct UnsafeMutableRawPointer: _Pointer {
653653
///
654654
/// let count = 4
655655
/// let bytesPointer = UnsafeMutableRawPointer.allocate(
656-
/// bytes: 100,
657-
/// alignedTo: MemoryLayout<Int8>.alignment)
656+
/// byteCount: 100,
657+
/// alignment: MemoryLayout<Int8>.alignment)
658658
/// let int8Pointer = bytesPointer.bindMemory(to: Int8.self, capacity: count)
659659
///
660660
/// After calling `bindMemory(to:capacity:)`, the first four bytes of the
@@ -716,7 +716,7 @@ public struct UnsafeMutableRawPointer: _Pointer {
716716
/// let bytesPointer = UnsafeMutableRawPointer.allocate(
717717
/// byteCount: count * MemoryLayout<Int8>.stride,
718718
/// alignment: MemoryLayout<Int8>.alignment)
719-
/// let int8Pointer = myBytes.initializeMemory(
719+
/// let int8Pointer = bytesPointer.initializeMemory(
720720
/// as: Int8.self, repeating: 0, count: count)
721721
///
722722
/// // After using 'int8Pointer':
@@ -764,8 +764,8 @@ public struct UnsafeMutableRawPointer: _Pointer {
764764
///
765765
/// let count = 4
766766
/// let bytesPointer = UnsafeMutableRawPointer.allocate(
767-
/// bytes: count * MemoryLayout<Int8>.stride,
768-
/// alignedTo: MemoryLayout<Int8>.alignment)
767+
/// byteCount: count * MemoryLayout<Int8>.stride,
768+
/// alignment: MemoryLayout<Int8>.alignment)
769769
/// let values: [Int8] = [1, 2, 3, 4]
770770
/// let int8Pointer = values.withUnsafeBufferPointer { buffer in
771771
/// return bytesPointer.initializeMemory(as: Int8.self,
@@ -776,7 +776,7 @@ public struct UnsafeMutableRawPointer: _Pointer {
776776
/// // (int8Pointer + 3).pointee == 4
777777
///
778778
/// // After using 'int8Pointer':
779-
/// int8Pointer.deallocate(count)
779+
/// int8Pointer.deallocate()
780780
///
781781
/// After calling this method on a raw pointer `p`, the region starting at
782782
/// `p` and continuing up to `p + count * MemoryLayout<T>.stride` is bound
@@ -933,7 +933,7 @@ public struct UnsafeMutableRawPointer: _Pointer {
933933
///
934934
/// let typedPointer = p.bindMemory(to: U.self, capacity: 1)
935935
/// typedPointer.deinitialize(count: 1)
936-
/// p.initializeMemory(as: T.self, to: newValue)
936+
/// p.initializeMemory(as: T.self, repeating: newValue, count: 1)
937937
///
938938
/// - Parameters:
939939
/// - value: The value to store as raw bytes.

0 commit comments

Comments
 (0)