summaryrefslogtreecommitdiff
path: root/xmake/core/base/libc.lua
diff options
context:
space:
mode:
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 4b3a9f3ec..ff6a88401 100644
--- a/xmake/core/base/libc.lua
+++ b/xmake/core/base/libc.lua
@@ -25,6 +25,7 @@ local libc = libc or {}
libc._malloc = libc._malloc or libc.malloc
libc._free = libc._free or libc.free
libc._memcpy = libc._memcpy or libc.memcpy
+libc._memset = libc._memset or libc.memset
-- load modules
local ffi = xmake._LUAJIT and require("ffi")
@@ -61,5 +62,13 @@ function libc.memcpy(dst, src, size)
end
end
+function libc.memset(data, ch, size)
+ if ffi then
+ return ffi.fill(data, size, ch)
+ else
+ return libc._memset(data, ch, size)
+ end
+end
+
-- return module: libc
return libc