[stdlib] Change C-style for loop to Swift-style for-in loop

This commit is contained in:
JohnLui
2016-01-09 12:57:55 +08:00
parent 33ed1e0ab6
commit 451ce376e3
5 changed files with 24 additions and 17 deletions

View File

@@ -60,7 +60,7 @@ public func _persistCString(s: UnsafePointer<CChar>) -> [CChar]? {
}
let length = Int(_swift_stdlib_strlen(s))
var result = [CChar](count: length + 1, repeatedValue: 0)
for var i = 0; i < length; i += 1 {
for i in 0..<length {
// FIXME: this will not compile on platforms where 'CChar' is unsigned.
result[i] = s[i]
}