summaryrefslogtreecommitdiff
path: root/xmake/core/base/bytes.lua
diff options
context:
space:
mode:
authorOpportunity <[email protected]>2020-01-18 19:52:01 +0800
committerOpportunity <[email protected]>2020-01-19 13:01:08 +0800
commitfaca684d1ec62de7bc3e56224c986ab24533f4fa (patch)
tree93703488961974b15a8e61e6c19a3c2423010ee3 /xmake/core/base/bytes.lua
parent1ba3e7c62e0f64b95923c2a41249ec956c436871 (diff)
use table.new
Diffstat (limited to 'xmake/core/base/bytes.lua')
-rw-r--r--xmake/core/base/bytes.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/xmake/core/base/bytes.lua b/xmake/core/base/bytes.lua
index 54343a962..3776695a1 100644
--- a/xmake/core/base/bytes.lua
+++ b/xmake/core/base/bytes.lua
@@ -65,6 +65,7 @@ function _instance.new(...)
else
-- bytes(size): allocates a buffer of given size
ptr = ffi.C.malloc(size)
+ ffi.fill(ptr, size, 0)
instance._CDATA = ffi.gc(ffi.cast("unsigned char*", ptr), ffi.C.free)
instance._MANAGED = true
end