Skip to content

Commit

Permalink
[Embedded] Correct the signature of free to avoid using Builtin modul…
Browse files Browse the repository at this point in the history
…e for potential client implementations
  • Loading branch information
phausler committed Jul 26, 2024
1 parent ac0f574 commit 2944529
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions stdlib/public/core/EmbeddedRuntime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public struct HeapObject {
func posix_memalign(_: UnsafeMutablePointer<UnsafeMutableRawPointer?>, _: Int, _: Int) -> CInt

@_extern(c, "free")
func free(_ p: Builtin.RawPointer)
func free(_ p: UnsafeMutableRawPointer?)



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

@_cdecl("swift_slowDealloc")
public func swift_slowDealloc(_ ptr: UnsafeMutableRawPointer, _ size: Int, _ alignMask: Int) {
free(ptr._rawValue)
free(ptr)
}

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

func swift_deallocObject(object: UnsafeMutablePointer<HeapObject>, allocatedSize: Int, allocatedAlignMask: Int) {
free(object._rawValue)
free(UnsafeMutableRawPointer(object))
}

@_cdecl("swift_deallocClassInstance")
Expand All @@ -134,7 +134,7 @@ func swift_deallocClassInstance(object: UnsafeMutablePointer<HeapObject>, alloca
return
}

free(object._rawValue)
free(UnsafeMutableRawPointer(object))
}

@_cdecl("swift_deallocPartialClassInstance")
Expand Down

0 comments on commit 2944529

Please sign in to comment.