Skip to content

Commit bc62c14

Browse files
authored
Eliminated "dangling pointer" warnings at DriverUtils (swiftlang#28648)
Eliminated "dangling pointer" warnings at DriverUtils
2 parents 9c638ae + d1259ce commit bc62c14

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

benchmark/utils/DriverUtils.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,10 @@ final class TestRunner {
412412
private static func getExecutedInstructions() -> UInt64 {
413413
if #available(OSX 10.9, iOS 7.0, *) {
414414
var u = rusage_info_v4()
415-
let p = UnsafeMutablePointer(&u)
416-
p.withMemoryRebound(to: Optional<rusage_info_t>.self, capacity: 1) { up in
417-
let _ = proc_pid_rusage(getpid(), RUSAGE_INFO_V4, up)
415+
withUnsafeMutablePointer(to: &u) { p in
416+
p.withMemoryRebound(to: Optional<rusage_info_t>.self, capacity: 1) { up in
417+
let _ = proc_pid_rusage(getpid(), RUSAGE_INFO_V4, up)
418+
}
418419
}
419420
return u.ri_instructions
420421
} else {

0 commit comments

Comments
 (0)