Browse Source

`MemFree` as a procedure group for both `rawptr` and `cstring`

gingerBill 11 months ago
parent
commit
61b3af5b08
1 changed files with 18 additions and 1 deletions
  1. 18 1
      vendor/raylib/raylib.odin

+ 18 - 1
vendor/raylib/raylib.odin

@@ -1029,7 +1029,6 @@ foreign lib {
 	SetTraceLogLevel :: proc(logLevel: TraceLogLevel) ---                                       // Set the current threshold (minimum) log level
 	MemAlloc         :: proc(size: c.uint) -> rawptr ---                                        // Internal memory allocator
 	MemRealloc       :: proc(ptr: rawptr, size: c.uint) -> rawptr ---                           // Internal memory reallocator
-	MemFree          :: proc(ptr: rawptr) ---                                                   // Internal memory free
 
 	// Set custom callbacks
 	// WARNING: Callbacks setup is intended for advance users
@@ -1688,6 +1687,24 @@ TextFormatAlloc :: proc(text: cstring, args: ..any) -> cstring {
 }
 
 
+// Internal memory free
+MemFree :: proc{
+	MemFreePtr,
+	MemFreeCstring,
+}
+
+
+@(default_calling_convention="c")
+foreign lib {
+	@(link_name="MemFree")
+	MemFreePtr :: proc(ptr: rawptr) ---
+}
+
+MemFreeCstring :: proc "c" (s: cstring) {
+	MemFreePtr(rawptr(s))
+}
+
+
 MemAllocator :: proc "contextless" () -> mem.Allocator {
 	return mem.Allocator{MemAllocatorProc, nil}
 }