File tree Expand file tree Collapse file tree 2 files changed +2
-15
lines changed Expand file tree Collapse file tree 2 files changed +2
-15
lines changed Original file line number Diff line number Diff line change @@ -47,13 +47,7 @@ public struct ByteString: ExpressibleByArrayLiteral {
47
47
48
48
/// Create a byte string from the UTF8 encoding of a string.
49
49
public init ( encodingAsUTF8 string: String ) {
50
- let stringPtrStart = string. _contiguousUTF8
51
- defer { _fixLifetime ( string) }
52
- if stringPtrStart != nil {
53
- _bytes = [ UInt8] ( UnsafeBufferPointer ( start: stringPtrStart, count: string. utf8. count) )
54
- } else {
55
- _bytes = [ UInt8] ( string. utf8)
56
- }
50
+ _bytes = [ UInt8] ( string. utf8)
57
51
}
58
52
59
53
/// Access the byte string contents as an array.
Original file line number Diff line number Diff line change @@ -171,14 +171,7 @@ public class OutputByteStream: TextOutputStream {
171
171
172
172
/// Write a string to the buffer (as UTF8).
173
173
public final func write( _ string: String ) {
174
- // Fast path for contiguous strings. For some reason Swift itself
175
- // doesn't implement this optimization: <rdar://problem/24100375> Missing fast path for [UInt8] += String.UTF8View
176
- let stringPtrStart = string. _contiguousUTF8
177
- if stringPtrStart != nil {
178
- write ( UnsafeBufferPointer ( start: stringPtrStart, count: string. utf8. count) )
179
- } else {
180
- write ( sequence: string. utf8)
181
- }
174
+ write ( sequence: string. utf8)
182
175
}
183
176
184
177
/// Write a character to the buffer (as UTF8).
You can’t perform that action at this time.
0 commit comments