Skip to content

Commit 490b4ec

Browse files
committed
[test] avoid using array conversion for String-from-C-string
1 parent 2bfeb24 commit 490b4ec

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/Prototypes/PatternMatching.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,9 @@ extension Collection where Iterator.Element == UTF8.CodeUnit {
302302
a.reserveCapacity(count + 1)
303303
a.append(contentsOf: self)
304304
a.append(0)
305-
return String(reflecting: String(cString: a))
305+
return a.withUnsafeBufferPointer {
306+
String(reflecting: String(cString: $0.baseAddress!))
307+
}
306308
}
307309
}
308310

0 commit comments

Comments
 (0)