diff options
| author | ruki <[email protected]> | 2020-08-04 22:45:20 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-08-04 22:45:20 +0800 |
| commit | 81c072eaa6eadde5f6427e0109226a7fa04691b0 (patch) | |
| tree | 7243963c4614209145b441144093889fface5102 /core/src/xmake/process | |
| parent | 8b08fbb9f5f0f54dd1232f4bf387932116dde47f (diff) | |
improve pushpointer
Diffstat (limited to 'core/src/xmake/process')
| -rw-r--r-- | core/src/xmake/process/close.c | 8 | ||||
| -rw-r--r-- | core/src/xmake/process/kill.c | 6 | ||||
| -rw-r--r-- | core/src/xmake/process/open.c | 2 | ||||
| -rw-r--r-- | core/src/xmake/process/openv.c | 2 | ||||
| -rw-r--r-- | core/src/xmake/process/wait.c | 6 |
5 files changed, 11 insertions, 13 deletions
diff --git a/core/src/xmake/process/close.c b/core/src/xmake/process/close.c index bcbc6dfd3..a84964418 100644 --- a/core/src/xmake/process/close.c +++ b/core/src/xmake/process/close.c @@ -40,12 +40,12 @@ tb_int_t xm_process_close(lua_State* lua) // check tb_assert_and_check_return_val(lua, 0); - // is user data? - if (!lua_isuserdata(lua, 1)) + // is pointer? + if (!xm_lua_ispointer(lua, 1)) return 0; // get the process - tb_process_ref_t process = (tb_process_ref_t)lua_touserdata(lua, 1); + tb_process_ref_t process = (tb_process_ref_t)xm_lua_topointer(lua, 1); tb_check_return_val(process, 0); // exit process @@ -53,7 +53,5 @@ tb_int_t xm_process_close(lua_State* lua) // save result: ok lua_pushboolean(lua, tb_true); - - // ok return 1; } diff --git a/core/src/xmake/process/kill.c b/core/src/xmake/process/kill.c index 1a695dc27..754d2d2aa 100644 --- a/core/src/xmake/process/kill.c +++ b/core/src/xmake/process/kill.c @@ -40,12 +40,12 @@ tb_int_t xm_process_kill(lua_State* lua) // check tb_assert_and_check_return_val(lua, 0); - // is user data? - if (!lua_isuserdata(lua, 1)) + // is pointer? + if (!xm_lua_ispointer(lua, 1)) return 0; // get the process - tb_process_ref_t process = (tb_process_ref_t)lua_touserdata(lua, 1); + tb_process_ref_t process = (tb_process_ref_t)xm_lua_topointer(lua, 1); tb_check_return_val(process, 0); // kill process diff --git a/core/src/xmake/process/open.c b/core/src/xmake/process/open.c index d027887b7..4a143b901 100644 --- a/core/src/xmake/process/open.c +++ b/core/src/xmake/process/open.c @@ -217,7 +217,7 @@ tb_int_t xm_process_open(lua_State* lua) // init process tb_process_ref_t process = (tb_process_ref_t)tb_process_init_cmd(command, &attr); - if (process) lua_pushlightuserdata(lua, (tb_pointer_t)process); + if (process) xm_lua_pushpointer(lua, (tb_pointer_t)process); else lua_pushnil(lua); return 1; } diff --git a/core/src/xmake/process/openv.c b/core/src/xmake/process/openv.c index c81e98d88..062a7e343 100644 --- a/core/src/xmake/process/openv.c +++ b/core/src/xmake/process/openv.c @@ -259,7 +259,7 @@ tb_int_t xm_process_openv(lua_State* lua) // init process tb_process_ref_t process = (tb_process_ref_t)tb_process_init(shellname, argv, &attr); - if (process) lua_pushlightuserdata(lua, (tb_pointer_t)process); + if (process) xm_lua_pushpointer(lua, (tb_pointer_t)process); else lua_pushnil(lua); // exit argv diff --git a/core/src/xmake/process/wait.c b/core/src/xmake/process/wait.c index 0f85f6e2d..bec6f379f 100644 --- a/core/src/xmake/process/wait.c +++ b/core/src/xmake/process/wait.c @@ -40,8 +40,8 @@ tb_int_t xm_process_wait(lua_State* lua) // check tb_assert_and_check_return_val(lua, 0); - // is user data? - if (!lua_isuserdata(lua, 1)) + // is pointer? + if (!xm_lua_ispointer(lua, 1)) { // error lua_pushfstring(lua, "invalid argument type(%s) for process.wait", luaL_typename(lua, 1)); @@ -50,7 +50,7 @@ tb_int_t xm_process_wait(lua_State* lua) } // get the process - tb_process_ref_t process = (tb_process_ref_t)lua_touserdata(lua, 1); + tb_process_ref_t process = (tb_process_ref_t)xm_lua_topointer(lua, 1); tb_check_return_val(process, 0); // get the timeout |
