Skip to content

Commit 5e2e467

Browse files
authored
Merge pull request #21631 from Azoy/something-something-string-storage
[stdlib] NFC: Simplify _getCString
2 parents 5cd7404 + 5532a16 commit 5e2e467

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)