summaryrefslogtreecommitdiff
path: root/core/src/xmake/libc/strndup.c
diff options
context:
space:
mode:
authorruki <[email protected]>2021-09-21 00:52:15 +0800
committerruki <[email protected]>2021-09-21 00:52:15 +0800
commitbce8f65cb9f619dfa30d7b4b1fa2da9fa56b58e1 (patch)
treee05136ba9eaa706a2d2cabab6732a9410b05e297 /core/src/xmake/libc/strndup.c
parent4181bf780192cbf4be257fb7b658cfb390684a12 (diff)
improve bytes
Diffstat (limited to 'core/src/xmake/libc/strndup.c')
-rw-r--r--core/src/xmake/libc/strndup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/src/xmake/libc/strndup.c b/core/src/xmake/libc/strndup.c
index f2a3b8359..b56a76714 100644
--- a/core/src/xmake/libc/strndup.c
+++ b/core/src/xmake/libc/strndup.c
@@ -40,8 +40,8 @@ tb_int_t xm_libc_strndup(lua_State* lua)
// do strndup
tb_char_t const* s = tb_null;
- if (xm_lua_ispointer(lua, 1))
- s = (tb_char_t const*)xm_lua_topointer(lua, 1);
+ if (lua_isnumber(lua, 1))
+ s = (tb_char_t const*)(tb_size_t)lua_tointeger(lua, 1);
else if (lua_isstring(lua, 2))
s = lua_tostring(lua, 2);
else xm_libc_return_error(lua, "libc.strndup(invalid args)!");