From c1933e6e8e7212f16443e99d66e7d656438da317 Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 20 Sep 2021 21:01:12 +0800 Subject: add libc.free --- xmake/core/base/libc.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'xmake/core/base/libc.lua') diff --git a/xmake/core/base/libc.lua b/xmake/core/base/libc.lua index bac224df3..914065f2e 100644 --- a/xmake/core/base/libc.lua +++ b/xmake/core/base/libc.lua @@ -23,6 +23,7 @@ local libc = libc or {} -- save original interfaces libc._malloc = libc._malloc or libc.malloc +libc._free = libc._free or libc.free -- load modules local ffi = xmake._LUAJIT and require("ffi") @@ -43,5 +44,13 @@ function libc.malloc(size) end end +function libc.free(data) + if ffi then + return ffi.C.free(data) + else + return libc._free(data) + end +end + -- return module: libc return libc -- cgit v1.3.1