Skip to content

Commit cb04de1

Browse files
committed
[stdlib] harmonize parameter labels with StringProtocol
1 parent 490b4ec commit cb04de1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

stdlib/public/core/CString.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@ extension String {
4242
/// }
4343
/// // Prints "Caf�"
4444
///
45-
/// - Parameter cString: A pointer to a null-terminated UTF-8 code sequence.
46-
public init(cString: UnsafePointer<CChar>) {
47-
let len = UTF8._nullCodeUnitOffset(in: cString)
45+
/// - Parameter nullTerminatedUTF8: A pointer to a null-terminated UTF-8 code sequence.
46+
public init(cString nullTerminatedUTF8: UnsafePointer<CChar>) {
47+
let len = UTF8._nullCodeUnitOffset(in: nullTerminatedUTF8)
4848
self = String._fromUTF8Repairing(
49-
UnsafeBufferPointer(start: cString._asUInt8, count: len)).0
49+
UnsafeBufferPointer(start: nullTerminatedUTF8._asUInt8, count: len)).0
5050
}
5151

5252
/// Creates a new string by copying the null-terminated UTF-8 data referenced
5353
/// by the given pointer.
5454
///
5555
/// This is identical to `init(cString: UnsafePointer<CChar>)` but operates on
5656
/// an unsigned sequence of bytes.
57-
public init(cString: UnsafePointer<UInt8>) {
58-
let len = UTF8._nullCodeUnitOffset(in: cString)
57+
public init(cString nullTerminatedUTF8: UnsafePointer<UInt8>) {
58+
let len = UTF8._nullCodeUnitOffset(in: nullTerminatedUTF8)
5959
self = String._fromUTF8Repairing(
60-
UnsafeBufferPointer(start: cString, count: len)).0
60+
UnsafeBufferPointer(start: nullTerminatedUTF8, count: len)).0
6161
}
6262

6363
/// Creates a new string by copying and validating the null-terminated UTF-8
@@ -179,10 +179,10 @@ extension String {
179179
@_specialize(where Encoding == Unicode.UTF16)
180180
@inlinable // Fold away specializations
181181
public init<Encoding: Unicode.Encoding>(
182-
decodingCString ptr: UnsafePointer<Encoding.CodeUnit>,
182+
decodingCString nullTerminatedCodeUnits: UnsafePointer<Encoding.CodeUnit>,
183183
as sourceEncoding: Encoding.Type
184184
) {
185-
self = String.decodeCString(ptr, as: sourceEncoding)!.0
185+
self = String.decodeCString(nullTerminatedCodeUnits, as: sourceEncoding)!.0
186186
}
187187
}
188188

0 commit comments

Comments
 (0)