Skip to content

Commit 2944529

Browse files
committed
[Embedded] Correct the signature of free to avoid using Builtin module for potential client implementations
1 parent ac0f574 commit 2944529

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stdlib/public/core/EmbeddedRuntime.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public struct HeapObject {
7373
func posix_memalign(_: UnsafeMutablePointer<UnsafeMutableRawPointer?>, _: Int, _: Int) -> CInt
7474

7575
@_extern(c, "free")
76-
func free(_ p: Builtin.RawPointer)
76+
func free(_ p: UnsafeMutableRawPointer?)
7777

7878

7979

@@ -99,7 +99,7 @@ public func swift_slowAlloc(_ size: Int, _ alignMask: Int) -> UnsafeMutableRawPo
9999

100100
@_cdecl("swift_slowDealloc")
101101
public func swift_slowDealloc(_ ptr: UnsafeMutableRawPointer, _ size: Int, _ alignMask: Int) {
102-
free(ptr._rawValue)
102+
free(ptr)
103103
}
104104

105105
@_cdecl("swift_allocObject")
@@ -121,7 +121,7 @@ public func swift_deallocObject(object: Builtin.RawPointer, allocatedSize: Int,
121121
}
122122

123123
func swift_deallocObject(object: UnsafeMutablePointer<HeapObject>, allocatedSize: Int, allocatedAlignMask: Int) {
124-
free(object._rawValue)
124+
free(UnsafeMutableRawPointer(object))
125125
}
126126

127127
@_cdecl("swift_deallocClassInstance")
@@ -134,7 +134,7 @@ func swift_deallocClassInstance(object: UnsafeMutablePointer<HeapObject>, alloca
134134
return
135135
}
136136

137-
free(object._rawValue)
137+
free(UnsafeMutableRawPointer(object))
138138
}
139139

140140
@_cdecl("swift_deallocPartialClassInstance")

0 commit comments

Comments
 (0)