Skip to content

Commit 2f6fb2d

Browse files
authored
Merge pull request #36507 from Catfish-Man/theres-a-hole-at-the-end-where-the-bits-fall-out
2 parents 4daac06 + e793e0e commit 2f6fb2d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

stdlib/public/core/StringBridge.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ internal func _bridgeTagged(
351351
private func _NSStringASCIIPointer(_ str: _StringSelectorHolder) -> UnsafePointer<UInt8>? {
352352
// TODO(String bridging): Is there a better interface here? Ideally we'd be
353353
// able to ask for UTF8 rather than just ASCII
354-
return str._fastCStringContents(0)?._asUInt8
354+
//TODO(String bridging): Unconditionally asking for nul-terminated contents is
355+
// overly conservative and hurts perf with some NSStrings
356+
return str._fastCStringContents(1)?._asUInt8
355357
}
356358

357359
@_effects(readonly) // @opaque

0 commit comments

Comments
 (0)