summaryrefslogtreecommitdiff
path: root/xmake/core/base/libc.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-09-20 21:01:12 +0800
committerruki <[email protected]>2021-09-20 21:01:12 +0800
commitc1933e6e8e7212f16443e99d66e7d656438da317 (patch)
treeb82357d2933cf64ae9f6309fda5bec4e7fdd3ca2 /xmake/core/base/libc.lua
parent33b05eff154f9158a68b0808f4be0f6c88aa6361 (diff)
add libc.free
Diffstat (limited to 'xmake/core/base/libc.lua')
-rw-r--r--xmake/core/base/libc.lua9
1 files changed, 9 insertions, 0 deletions
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