Skip to content

Commit 5532a16

Browse files
committed
simplify _getCString
1 parent c9ff626 commit 5532a16

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

stdlib/public/core/StringStorage.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ extension _AbstractStringStorage {
7676
fallthrough
7777
case (_cocoaUTF8Encoding, _):
7878
guard maxLength >= count + 1 else { return 0 }
79-
let buffer = UnsafeMutableBufferPointer(start: outputPtr, count: maxLength)
80-
_ = buffer.initialize(from: UnsafeBufferPointer(start: start, count: count))
81-
buffer[count] = 0
79+
outputPtr.initialize(from: start, count: count)
80+
outputPtr[count] = 0
8281
return 1
8382
default:
8483
return _cocoaGetCStringTrampoline(self, outputPtr, maxLength, encoding)

0 commit comments

Comments
 (0)