implement SE 184: add allocation methods to Unsafe buffer pointers, drop all parameters from deallocation, adjust namings, and add repeated-value assignment methods

This commit is contained in:
taylor swift
2017-11-06 14:40:15 -06:00
committed by Andrew Trick
parent c7d33e70d3
commit c85880899d
42 changed files with 561 additions and 263 deletions

View File

@@ -507,7 +507,7 @@ func getASCIIUTF8() -> (UnsafeMutablePointer<UInt8>, dealloc: () -> ()) {
up[0] = 0x61
up[1] = 0x62
up[2] = 0
return (up, { up.deallocate(capacity: 100) })
return (up, { up.deallocate() })
}
func getNonASCIIUTF8() -> (UnsafeMutablePointer<UInt8>, dealloc: () -> ()) {
@@ -517,7 +517,7 @@ func getNonASCIIUTF8() -> (UnsafeMutablePointer<UInt8>, dealloc: () -> ()) {
up[2] = 0xd0
up[3] = 0xb1
up[4] = 0
return (UnsafeMutablePointer(up), { up.deallocate(capacity: 100) })
return (UnsafeMutablePointer(up), { up.deallocate() })
}
func getIllFormedUTF8String1(
@@ -529,7 +529,7 @@ func getIllFormedUTF8String1(
up[3] = 0x80
up[4] = 0x41
up[5] = 0
return (UnsafeMutablePointer(up), { up.deallocate(capacity: 100) })
return (UnsafeMutablePointer(up), { up.deallocate() })
}
func getIllFormedUTF8String2(
@@ -542,7 +542,7 @@ func getIllFormedUTF8String2(
up[3] = 0x81
up[4] = 0x41
up[5] = 0
return (UnsafeMutablePointer(up), { up.deallocate(capacity: 100) })
return (UnsafeMutablePointer(up), { up.deallocate() })
}
func asCCharArray(_ a: [UInt8]) -> [CChar] {
@@ -677,4 +677,3 @@ CStringTests.test("String.utf8CString") {
}
runAllTests()