summaryrefslogtreecommitdiff
path: root/core/src/xmake/libc/malloc.c
diff options
context:
space:
mode:
authorruki <[email protected]>2025-11-10 06:35:04 +0800
committerGitHub <[email protected]>2025-11-10 06:35:04 +0800
commit2b01e46fcf619aaecb8435b0fac975e3aff0587f (patch)
tree8f005a8dfc3272e9f027560e5e1b5881a7a8bc70 /core/src/xmake/libc/malloc.c
parenta1b0ec856e2c22aac84022feb05b6687912e3d6e (diff)
parent2c387895657ae13cd717d7f42f5baed5eb028a8e (diff)
Merge pull request #7008 from xmake-io/format
format code
Diffstat (limited to 'core/src/xmake/libc/malloc.c')
-rw-r--r--core/src/xmake/libc/malloc.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/core/src/xmake/libc/malloc.c b/core/src/xmake/libc/malloc.c
index 989cb6aac..6bda4167d 100644
--- a/core/src/xmake/libc/malloc.c
+++ b/core/src/xmake/libc/malloc.c
@@ -22,8 +22,8 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* trace
*/
-#define TB_TRACE_MODULE_NAME "malloc"
-#define TB_TRACE_MODULE_DEBUG (0)
+#define TB_TRACE_MODULE_NAME "malloc"
+#define TB_TRACE_MODULE_DEBUG (0)
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
@@ -33,16 +33,15 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* implementation
*/
-tb_int_t xm_libc_malloc(lua_State* lua)
-{
- // check
+tb_int_t xm_libc_malloc(lua_State *lua) {
tb_assert_and_check_return_val(lua, 0);
// do malloc
tb_pointer_t data = tb_null;
- tb_long_t size = (tb_long_t)luaL_checkinteger(lua, 1);
- if (size > 0) data = tb_malloc(size);
+ tb_long_t size = (tb_long_t)luaL_checkinteger(lua, 1);
+ if (size > 0) {
+ data = tb_malloc(size);
+ }
lua_pushinteger(lua, (lua_Integer)(tb_long_t)data);
return 1;
}
-