diff options
| author | ruki <[email protected]> | 2025-11-10 06:35:04 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-11-10 06:35:04 +0800 |
| commit | 2b01e46fcf619aaecb8435b0fac975e3aff0587f (patch) | |
| tree | 8f005a8dfc3272e9f027560e5e1b5881a7a8bc70 /core/src/xmake/libc/dataptr.c | |
| parent | a1b0ec856e2c22aac84022feb05b6687912e3d6e (diff) | |
| parent | 2c387895657ae13cd717d7f42f5baed5eb028a8e (diff) | |
Merge pull request #7008 from xmake-io/format
format code
Diffstat (limited to 'core/src/xmake/libc/dataptr.c')
| -rw-r--r-- | core/src/xmake/libc/dataptr.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/core/src/xmake/libc/dataptr.c b/core/src/xmake/libc/dataptr.c index b78b32558..881b373d2 100644 --- a/core/src/xmake/libc/dataptr.c +++ b/core/src/xmake/libc/dataptr.c @@ -22,8 +22,8 @@ /* ////////////////////////////////////////////////////////////////////////////////////// * trace */ -#define TB_TRACE_MODULE_NAME "dataptr" -#define TB_TRACE_MODULE_DEBUG (0) +#define TB_TRACE_MODULE_NAME "dataptr" +#define TB_TRACE_MODULE_DEBUG (0) /* ////////////////////////////////////////////////////////////////////////////////////// * includes @@ -33,20 +33,19 @@ /* ////////////////////////////////////////////////////////////////////////////////////// * implementation */ -tb_int_t xm_libc_dataptr(lua_State* lua) -{ - // check +tb_int_t xm_libc_dataptr(lua_State *lua) { tb_assert_and_check_return_val(lua, 0); tb_pointer_t data = tb_null; - if (lua_isstring(lua, 1)) + if (lua_isstring(lua, 1)) { data = (tb_pointer_t)luaL_checkstring(lua, 1); - else if (lua_isnumber(lua, 1)) + } else if (lua_isnumber(lua, 1)) { data = (tb_pointer_t)(tb_size_t)lua_tointeger(lua, 1); - else if (xm_lua_ispointer(lua, 1)) + } else if (xm_lua_ispointer(lua, 1)) { data = (tb_pointer_t)xm_lua_topointer(lua, 1); - else xm_libc_return_error(lua, "libc.dataptr(invalid data)!"); + } else { + xm_libc_return_error(lua, "libc.dataptr(invalid data)!"); + } lua_pushinteger(lua, (lua_Integer)(tb_long_t)data); return 1; } - |
