From c89c94bf89e98c8e42e786aacc0b334a57474179 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 9 Nov 2025 19:11:32 +0800 Subject: format code --- core/src/xmake/thread/thread_exit.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'core/src/xmake/thread/thread_exit.c') diff --git a/core/src/xmake/thread/thread_exit.c b/core/src/xmake/thread/thread_exit.c index 9d2c8e908..a91018ac6 100644 --- a/core/src/xmake/thread/thread_exit.c +++ b/core/src/xmake/thread/thread_exit.c @@ -22,8 +22,8 @@ /* ////////////////////////////////////////////////////////////////////////////////////// * trace */ -#define TB_TRACE_MODULE_NAME "thread" -#define TB_TRACE_MODULE_DEBUG (0) +#define TB_TRACE_MODULE_NAME "thread" +#define TB_TRACE_MODULE_DEBUG (0) /* ////////////////////////////////////////////////////////////////////////////////////// * includes @@ -33,8 +33,7 @@ /* ////////////////////////////////////////////////////////////////////////////////////// * implementation */ -tb_int_t xm_thread_exit(lua_State* lua) -{ +tb_int_t xm_thread_exit(lua_State *lua) { // check tb_assert_and_check_return_val(lua, 0); @@ -43,16 +42,14 @@ tb_int_t xm_thread_exit(lua_State* lua) return 0; // get thread - xm_thread_t* thread = (xm_thread_t*)xm_lua_topointer(lua, 1); + xm_thread_t *thread = (xm_thread_t *)xm_lua_topointer(lua, 1); tb_check_return_val(thread, 0); // exit thread - if (thread) - { + if (thread) { tb_string_exit(&thread->callback); tb_string_exit(&thread->callinfo); - if (thread->handle) - { + if (thread->handle) { tb_thread_exit(thread->handle); thread->handle = tb_null; } @@ -61,4 +58,3 @@ tb_int_t xm_thread_exit(lua_State* lua) lua_pushboolean(lua, tb_true); return 1; } - -- cgit v1.3.1 From 39189e3a1bd2979b7b454547b03e5926a8027431 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 9 Nov 2025 19:54:35 +0800 Subject: remove unused comments --- core/src/xmake/base64/decode.c | 1 - core/src/xmake/base64/encode.c | 1 - core/src/xmake/bloom_filter/bloom_filter_clear.c | 1 - core/src/xmake/bloom_filter/bloom_filter_close.c | 1 - core/src/xmake/bloom_filter/bloom_filter_data.c | 1 - .../src/xmake/bloom_filter/bloom_filter_data_set.c | 1 - core/src/xmake/bloom_filter/bloom_filter_get.c | 1 - core/src/xmake/bloom_filter/bloom_filter_open.c | 1 - core/src/xmake/bloom_filter/bloom_filter_set.c | 1 - core/src/xmake/bloom_filter/bloom_filter_size.c | 1 - core/src/xmake/engine.c | 24 ---------------------- core/src/xmake/fwatcher/add.c | 1 - core/src/xmake/fwatcher/close.c | 1 - core/src/xmake/fwatcher/open.c | 1 - core/src/xmake/fwatcher/remove.c | 1 - core/src/xmake/fwatcher/wait.c | 1 - core/src/xmake/hash/md5.c | 2 -- core/src/xmake/hash/rand128.c | 1 - core/src/xmake/hash/rand32.c | 1 - core/src/xmake/hash/rand64.c | 1 - core/src/xmake/hash/sha.c | 2 -- core/src/xmake/hash/uuid4.c | 1 - core/src/xmake/hash/xxhash.c | 2 -- core/src/xmake/io/file_close.c | 4 ---- core/src/xmake/io/file_flush.c | 2 -- core/src/xmake/io/file_isatty.c | 1 - core/src/xmake/io/file_open.c | 4 ---- core/src/xmake/io/file_rawfd.c | 1 - core/src/xmake/io/file_read.c | 13 ------------ core/src/xmake/io/file_readable.c | 1 - core/src/xmake/io/file_seek.c | 1 - core/src/xmake/io/file_size.c | 1 - core/src/xmake/io/file_write.c | 4 ---- core/src/xmake/io/filelock_close.c | 2 -- core/src/xmake/io/filelock_lock.c | 1 - core/src/xmake/io/filelock_open.c | 1 - core/src/xmake/io/filelock_trylock.c | 1 - core/src/xmake/io/filelock_unlock.c | 1 - core/src/xmake/io/pipe_close.c | 1 - core/src/xmake/io/pipe_connect.c | 1 - core/src/xmake/io/pipe_open.c | 1 - core/src/xmake/io/pipe_openpair.c | 1 - core/src/xmake/io/pipe_read.c | 1 - core/src/xmake/io/pipe_wait.c | 1 - core/src/xmake/io/pipe_write.c | 1 - core/src/xmake/io/poller_insert.c | 1 - core/src/xmake/io/poller_modify.c | 1 - core/src/xmake/io/poller_remove.c | 1 - core/src/xmake/io/poller_spank.c | 1 - core/src/xmake/io/poller_support.c | 1 - core/src/xmake/io/poller_wait.c | 3 --- core/src/xmake/io/socket_accept.c | 1 - core/src/xmake/io/socket_bind.c | 1 - core/src/xmake/io/socket_close.c | 1 - core/src/xmake/io/socket_connect.c | 1 - core/src/xmake/io/socket_ctrl.c | 1 - core/src/xmake/io/socket_kill.c | 1 - core/src/xmake/io/socket_listen.c | 1 - core/src/xmake/io/socket_open.c | 1 - core/src/xmake/io/socket_peeraddr.c | 1 - core/src/xmake/io/socket_rawfd.c | 1 - core/src/xmake/io/socket_recv.c | 1 - core/src/xmake/io/socket_recvfrom.c | 1 - core/src/xmake/io/socket_send.c | 1 - core/src/xmake/io/socket_sendfile.c | 1 - core/src/xmake/io/socket_sendto.c | 1 - core/src/xmake/io/socket_wait.c | 1 - core/src/xmake/io/stdfile.c | 1 - core/src/xmake/libc/byteof.c | 1 - core/src/xmake/libc/dataptr.c | 1 - core/src/xmake/libc/free.c | 1 - core/src/xmake/libc/malloc.c | 1 - core/src/xmake/libc/memcpy.c | 1 - core/src/xmake/libc/memmov.c | 1 - core/src/xmake/libc/memset.c | 1 - core/src/xmake/libc/setbyte.c | 1 - core/src/xmake/libc/strndup.c | 1 - core/src/xmake/lz4/block_compress.c | 1 - core/src/xmake/lz4/block_decompress.c | 1 - core/src/xmake/lz4/compress.c | 1 - core/src/xmake/lz4/compress_file.c | 2 -- core/src/xmake/lz4/compress_stream_close.c | 1 - core/src/xmake/lz4/compress_stream_open.c | 1 - core/src/xmake/lz4/compress_stream_read.c | 1 - core/src/xmake/lz4/compress_stream_write.c | 1 - core/src/xmake/lz4/decompress.c | 1 - core/src/xmake/lz4/decompress_file.c | 2 -- core/src/xmake/lz4/decompress_stream_close.c | 1 - core/src/xmake/lz4/decompress_stream_open.c | 1 - core/src/xmake/lz4/decompress_stream_read.c | 1 - core/src/xmake/lz4/decompress_stream_write.c | 1 - core/src/xmake/lz4/prefix.h | 4 ---- core/src/xmake/os/args.c | 2 -- core/src/xmake/os/argv.c | 1 - core/src/xmake/os/chdir.c | 2 -- core/src/xmake/os/cpdir.c | 1 - core/src/xmake/os/cpfile.c | 1 - core/src/xmake/os/cpuinfo.c | 1 - core/src/xmake/os/curdir.c | 1 - core/src/xmake/os/emptydir.c | 2 -- core/src/xmake/os/exists.c | 1 - core/src/xmake/os/filesize.c | 1 - core/src/xmake/os/find.c | 6 ------ core/src/xmake/os/fscase.c | 1 - core/src/xmake/os/getenv.c | 2 -- core/src/xmake/os/getenvs.c | 3 --- core/src/xmake/os/getown.c | 2 -- core/src/xmake/os/getpid.c | 1 - core/src/xmake/os/getwinsize.c | 2 -- core/src/xmake/os/gid.c | 2 -- core/src/xmake/os/isdir.c | 1 - core/src/xmake/os/isfile.c | 1 - core/src/xmake/os/islink.c | 1 - core/src/xmake/os/link.c | 2 -- core/src/xmake/os/mclock.c | 2 -- core/src/xmake/os/meminfo.c | 1 - core/src/xmake/os/mkdir.c | 2 -- core/src/xmake/os/mtime.c | 1 - core/src/xmake/os/readlink.c | 2 -- core/src/xmake/os/rename.c | 1 - core/src/xmake/os/rmdir.c | 6 ------ core/src/xmake/os/rmfile.c | 1 - core/src/xmake/os/setenv.c | 1 - core/src/xmake/os/signal.c | 1 - core/src/xmake/os/strerror.c | 1 - core/src/xmake/os/syserror.c | 1 - core/src/xmake/os/tmpdir.c | 1 - core/src/xmake/os/touch.c | 1 - core/src/xmake/os/uid.c | 2 -- core/src/xmake/package/loadxmi.c | 1 - core/src/xmake/path/absolute.c | 1 - core/src/xmake/path/directory.c | 1 - core/src/xmake/path/is_absolute.c | 1 - core/src/xmake/path/relative.c | 1 - core/src/xmake/path/translate.c | 1 - core/src/xmake/process/close.c | 1 - core/src/xmake/process/kill.c | 1 - core/src/xmake/process/open.c | 1 - core/src/xmake/process/openv.c | 2 -- core/src/xmake/process/wait.c | 2 -- core/src/xmake/readline/add_history.c | 2 -- core/src/xmake/readline/clear_history.c | 2 -- core/src/xmake/readline/history_list.c | 2 -- core/src/xmake/readline/readline.c | 2 -- core/src/xmake/sandbox/interactive.c | 6 ------ core/src/xmake/semver/compare.c | 2 -- core/src/xmake/semver/parse.c | 2 -- core/src/xmake/semver/satisfies.c | 1 - core/src/xmake/semver/select.c | 3 --- core/src/xmake/semver/semver.c | 1 - core/src/xmake/string/convert.c | 2 -- core/src/xmake/string/endswith.c | 2 -- core/src/xmake/string/lastof.c | 1 - core/src/xmake/string/split.c | 1 - core/src/xmake/string/startswith.c | 2 -- core/src/xmake/string/trim.c | 5 ----- core/src/xmake/thread/thread_exit.c | 1 - core/src/xmake/thread/thread_init.c | 1 - core/src/xmake/thread/thread_resume.c | 1 - core/src/xmake/thread/thread_suspend.c | 1 - core/src/xmake/thread/thread_wait.c | 1 - core/src/xmake/tty/term_mode.c | 1 - core/src/xmake/utils/bin2c.c | 1 - core/src/xmake/winos/ansi.c | 6 ------ core/src/xmake/winos/logical_drives.c | 1 - core/src/xmake/winos/registry_keys.c | 2 -- core/src/xmake/winos/registry_query.c | 2 -- core/src/xmake/winos/registry_values.c | 3 --- core/src/xmake/winos/short_path.c | 1 - core/src/xmake/xmake.c | 5 ----- 170 files changed, 285 deletions(-) (limited to 'core/src/xmake/thread/thread_exit.c') diff --git a/core/src/xmake/base64/decode.c b/core/src/xmake/base64/decode.c index 41555f5cc..cb1b7eb82 100644 --- a/core/src/xmake/base64/decode.c +++ b/core/src/xmake/base64/decode.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_base64_decode(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the string diff --git a/core/src/xmake/base64/encode.c b/core/src/xmake/base64/encode.c index cf2135e56..d896cb55e 100644 --- a/core/src/xmake/base64/encode.c +++ b/core/src/xmake/base64/encode.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_base64_encode(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get data and size diff --git a/core/src/xmake/bloom_filter/bloom_filter_clear.c b/core/src/xmake/bloom_filter/bloom_filter_clear.c index 3f6e36bd0..2657cc5dc 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_clear.c +++ b/core/src/xmake/bloom_filter/bloom_filter_clear.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_bloom_filter_clear(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/bloom_filter/bloom_filter_close.c b/core/src/xmake/bloom_filter/bloom_filter_close.c index 5c916b460..59d3e59a1 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_close.c +++ b/core/src/xmake/bloom_filter/bloom_filter_close.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_bloom_filter_close(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/bloom_filter/bloom_filter_data.c b/core/src/xmake/bloom_filter/bloom_filter_data.c index e37aea966..9d6f34e64 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_data.c +++ b/core/src/xmake/bloom_filter/bloom_filter_data.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_bloom_filter_data(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/bloom_filter/bloom_filter_data_set.c b/core/src/xmake/bloom_filter/bloom_filter_data_set.c index a6949d730..984ec6562 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_data_set.c +++ b/core/src/xmake/bloom_filter/bloom_filter_data_set.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_bloom_filter_data_set(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/bloom_filter/bloom_filter_get.c b/core/src/xmake/bloom_filter/bloom_filter_get.c index 755446a09..dd1f8d1e6 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_get.c +++ b/core/src/xmake/bloom_filter/bloom_filter_get.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_bloom_filter_get(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/bloom_filter/bloom_filter_open.c b/core/src/xmake/bloom_filter/bloom_filter_open.c index 68af8ae92..be364be91 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_open.c +++ b/core/src/xmake/bloom_filter/bloom_filter_open.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_bloom_filter_open(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get arguments diff --git a/core/src/xmake/bloom_filter/bloom_filter_set.c b/core/src/xmake/bloom_filter/bloom_filter_set.c index 9387d5354..51d85d0a7 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_set.c +++ b/core/src/xmake/bloom_filter/bloom_filter_set.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_bloom_filter_set(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/bloom_filter/bloom_filter_size.c b/core/src/xmake/bloom_filter/bloom_filter_size.c index 219035fe7..977b455f3 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_size.c +++ b/core/src/xmake/bloom_filter/bloom_filter_size.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_bloom_filter_size(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/engine.c b/core/src/xmake/engine.c index a65395423..7a07d72da 100644 --- a/core/src/xmake/engine.c +++ b/core/src/xmake/engine.c @@ -705,7 +705,6 @@ static tb_byte_t g_xmake_xmz_data[] = { * private implementation */ static tb_bool_t xm_engine_save_arguments(xm_engine_t *engine, tb_int_t argc, tb_char_t **argv, tb_char_t **taskargv) { - // check tb_assert_and_check_return_val(engine && engine->lua && argc >= 1 && argv, tb_false); #if defined(TB_CONFIG_OS_WINDOWS) && !defined(TB_COMPILER_LIKE_UNIX) @@ -745,7 +744,6 @@ static tb_bool_t xm_engine_save_arguments(xm_engine_t *engine, tb_int_t argc, tb } static tb_bool_t xm_engine_get_program_file(xm_engine_t *engine, tb_char_t **argv, tb_char_t *path, tb_size_t maxn) { - // check tb_assert_and_check_return_val(engine && path && maxn, tb_false); /* we cache it, because the current path will be changed in thread. @@ -774,13 +772,11 @@ static tb_bool_t xm_engine_get_program_file(xm_engine_t *engine, tb_char_t **arg tb_wchar_t buf[TB_PATH_MAXN] = { 0 }; tb_size_t size = (tb_size_t)GetModuleFileNameW(tb_null, buf, (DWORD)TB_PATH_MAXN); tb_assert_and_check_break(size < TB_PATH_MAXN); - // end buf[size] = L'\0'; size = tb_wcstombs(path, buf, maxn); tb_assert_and_check_break(size < maxn); path[size] = '\0'; - // ok ok = tb_true; #elif defined(TB_CONFIG_OS_MACOSX) || defined(TB_CONFIG_OS_IOS) @@ -855,9 +851,7 @@ static tb_bool_t xm_engine_get_program_file(xm_engine_t *engine, tb_char_t **arg } while (0); - // ok? if (ok) { - // trace tb_trace_d("programfile: %s", path); // cache it @@ -894,7 +888,6 @@ static tb_bool_t xm_engine_get_program_directory(xm_engine_t *engine, tb_char_t *path, tb_size_t maxn, tb_char_t const *programfile) { - // check tb_assert_and_check_return_val(engine && path && maxn, tb_false); static tb_char_t s_program_directory[TB_PATH_MAXN] = { 0 }; @@ -980,9 +973,7 @@ static tb_bool_t xm_engine_get_program_directory(xm_engine_t *engine, } while (0); - // ok? if (ok) { - // trace tb_trace_d("programdir: %s", path); // cache it @@ -993,12 +984,10 @@ static tb_bool_t xm_engine_get_program_directory(xm_engine_t *engine, lua_setglobal(engine->lua, "_PROGRAM_DIR"); } - // ok? return ok; } static tb_bool_t xm_engine_get_project_directory(xm_engine_t *engine, tb_char_t *path, tb_size_t maxn) { - // check tb_assert_and_check_return_val(engine && path && maxn, tb_false); tb_bool_t ok = tb_false; @@ -1011,14 +1000,12 @@ static tb_bool_t xm_engine_get_project_directory(xm_engine_t *engine, tb_char_t break; } - // trace tb_trace_d("project: %s", path); // save the directory to the global variable: _PROJECT_DIR lua_pushstring(engine->lua, path); lua_setglobal(engine->lua, "_PROJECT_DIR"); - // ok ok = tb_true; } while (0); @@ -1027,7 +1014,6 @@ static tb_bool_t xm_engine_get_project_directory(xm_engine_t *engine, tb_char_t if (!ok) tb_printf("error: not found the project directory!\n"); - // ok? return ok; } @@ -1061,7 +1047,6 @@ static tb_void_t xm_engine_signal_handler(tb_int_t signo) { #endif static tb_void_t xm_engine_init_host(xm_engine_t *engine) { - // check tb_assert_and_check_return(engine && engine->lua); // init system host @@ -1146,7 +1131,6 @@ static __tb_inline__ tb_char_t const *xm_engine_xmake_arch() { } static tb_void_t xm_engine_init_arch(xm_engine_t *engine) { - // check tb_assert_and_check_return(engine && engine->lua); // init xmake arch @@ -1225,7 +1209,6 @@ static tb_void_t xm_engine_init_arch(xm_engine_t *engine) { } static tb_void_t xm_engine_init_features(xm_engine_t *engine) { - // check tb_assert_and_check_return(engine && engine->lua); // init features @@ -1660,7 +1643,6 @@ xm_engine_ref_t xm_engine_init(tb_char_t const *name, xm_engine_lni_initalizer_c return (xm_engine_ref_t)engine; } tb_void_t xm_engine_exit(xm_engine_ref_t self) { - // check xm_engine_t *engine = (xm_engine_t *)self; tb_assert_and_check_return(engine); @@ -1678,7 +1660,6 @@ tb_void_t xm_engine_exit(xm_engine_ref_t self) { tb_free(engine); } tb_int_t xm_engine_main(xm_engine_ref_t self, tb_int_t argc, tb_char_t **argv, tb_char_t **taskargv) { - // check xm_engine_t *engine = (xm_engine_t *)self; tb_assert_and_check_return_val(engine && engine->lua, -1); @@ -1719,7 +1700,6 @@ tb_int_t xm_engine_main(xm_engine_ref_t self, tb_int_t argc, tb_char_t **argv, t return -1; } - // trace tb_trace_d("main: %s", path); // load and execute the main script @@ -1741,7 +1721,6 @@ tb_int_t xm_engine_main(xm_engine_ref_t self, tb_int_t argc, tb_char_t **argv, t return (tb_int_t)lua_tonumber(engine->lua, -1); } tb_void_t xm_engine_register(xm_engine_ref_t self, tb_char_t const *module, luaL_Reg const funcs[]) { - // check xm_engine_t *engine = (xm_engine_t *)self; tb_assert_and_check_return(engine && engine->lua && module && funcs); @@ -1753,7 +1732,6 @@ tb_void_t xm_engine_register(xm_engine_ref_t self, tb_char_t const *module, luaL } #ifdef XM_EMBED_ENABLE tb_void_t xm_engine_add_embedfiles(xm_engine_ref_t self, tb_byte_t const *data, tb_size_t size) { - // check xm_engine_t *engine = (xm_engine_t *)self; tb_assert_and_check_return(engine && engine->embedcount < tb_arrayn(engine->embedsize) && data && size); @@ -1763,14 +1741,12 @@ tb_void_t xm_engine_add_embedfiles(xm_engine_ref_t self, tb_byte_t const *data, } #endif lua_State *xm_engine_lua(xm_engine_ref_t self) { - // check xm_engine_t *engine = (xm_engine_t *)self; tb_assert_and_check_return_val(engine, tb_null); return engine->lua; } tb_poller_ref_t xm_engine_poller(xm_engine_ref_t self) { - // check xm_engine_t *engine = (xm_engine_t *)self; tb_assert_and_check_return_val(engine, tb_null); diff --git a/core/src/xmake/fwatcher/add.c b/core/src/xmake/fwatcher/add.c index cda233104..77c23ea48 100644 --- a/core/src/xmake/fwatcher/add.c +++ b/core/src/xmake/fwatcher/add.c @@ -36,7 +36,6 @@ // fwatcher.add(watchdir, recursion) tb_int_t xm_fwatcher_add(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/fwatcher/close.c b/core/src/xmake/fwatcher/close.c index 8f6a680be..a5501d906 100644 --- a/core/src/xmake/fwatcher/close.c +++ b/core/src/xmake/fwatcher/close.c @@ -36,7 +36,6 @@ // fwatcher.close(p) tb_int_t xm_fwatcher_close(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/fwatcher/open.c b/core/src/xmake/fwatcher/open.c index 05173660e..13ab91d5a 100644 --- a/core/src/xmake/fwatcher/open.c +++ b/core/src/xmake/fwatcher/open.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_fwatcher_open(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // init fwatcher diff --git a/core/src/xmake/fwatcher/remove.c b/core/src/xmake/fwatcher/remove.c index d7ef4d289..6285b0649 100644 --- a/core/src/xmake/fwatcher/remove.c +++ b/core/src/xmake/fwatcher/remove.c @@ -36,7 +36,6 @@ // fwatcher.remove(watchdir) tb_int_t xm_fwatcher_remove(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/fwatcher/wait.c b/core/src/xmake/fwatcher/wait.c index d4e64347f..42b01b8aa 100644 --- a/core/src/xmake/fwatcher/wait.c +++ b/core/src/xmake/fwatcher/wait.c @@ -36,7 +36,6 @@ // fwatcher.wait(p) tb_int_t xm_fwatcher_wait(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/hash/md5.c b/core/src/xmake/hash/md5.c index 91f7eafc9..3c871b063 100644 --- a/core/src/xmake/hash/md5.c +++ b/core/src/xmake/hash/md5.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_hash_md5(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is bytes? get data and size @@ -81,7 +80,6 @@ tb_int_t xm_hash_md5(lua_State *lua) { // read data tb_long_t real = tb_stream_read(stream, data, sizeof(data)); - // ok? if (real > 0) tb_md5_spak(&md5, data, real); // no data? continue it diff --git a/core/src/xmake/hash/rand128.c b/core/src/xmake/hash/rand128.c index bb844aee9..625e75326 100644 --- a/core/src/xmake/hash/rand128.c +++ b/core/src/xmake/hash/rand128.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_hash_rand128(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); static union { diff --git a/core/src/xmake/hash/rand32.c b/core/src/xmake/hash/rand32.c index a8a2dc054..844dd83e7 100644 --- a/core/src/xmake/hash/rand32.c +++ b/core/src/xmake/hash/rand32.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_hash_rand32(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); static tb_uint64_t s_seed = 0; diff --git a/core/src/xmake/hash/rand64.c b/core/src/xmake/hash/rand64.c index 05b861327..0f9e39069 100644 --- a/core/src/xmake/hash/rand64.c +++ b/core/src/xmake/hash/rand64.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_hash_rand64(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); static union { diff --git a/core/src/xmake/hash/sha.c b/core/src/xmake/hash/sha.c index 12d98b860..158a09208 100644 --- a/core/src/xmake/hash/sha.c +++ b/core/src/xmake/hash/sha.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_hash_sha(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get mode @@ -88,7 +87,6 @@ tb_int_t xm_hash_sha(lua_State *lua) { // read data tb_long_t real = tb_stream_read(stream, data, sizeof(data)); - // ok? if (real > 0) tb_sha_spak(&sha, data, real); // no data? continue it diff --git a/core/src/xmake/hash/uuid4.c b/core/src/xmake/hash/uuid4.c index d99e849d8..8712e9efa 100644 --- a/core/src/xmake/hash/uuid4.c +++ b/core/src/xmake/hash/uuid4.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_hash_uuid4(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the name diff --git a/core/src/xmake/hash/xxhash.c b/core/src/xmake/hash/xxhash.c index 49e1199e8..7a55ce63d 100644 --- a/core/src/xmake/hash/xxhash.c +++ b/core/src/xmake/hash/xxhash.c @@ -38,7 +38,6 @@ * implementation */ tb_int_t xm_hash_xxhash(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get mode @@ -115,7 +114,6 @@ tb_int_t xm_hash_xxhash(lua_State *lua) { // read data tb_long_t real = tb_stream_read(stream, data, sizeof(data)); - // ok? if (real > 0) { if (mode == 32 || mode == 64) XM_XXH3_64bits_update(state, data, real); diff --git a/core/src/xmake/io/file_close.c b/core/src/xmake/io/file_close.c index e00946dd0..6547b8156 100644 --- a/core/src/xmake/io/file_close.c +++ b/core/src/xmake/io/file_close.c @@ -36,7 +36,6 @@ // io.file_close(file) tb_int_t xm_io_file_close(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is user data? @@ -49,7 +48,6 @@ tb_int_t xm_io_file_close(lua_State *lua) { // close file if (xm_io_file_is_file(file)) { - // check tb_assert(file->u.file_ref); #ifdef TB_CONFIG_OS_WINDOWS @@ -90,7 +88,6 @@ tb_int_t xm_io_file_close(lua_State *lua) { // gc will free it if no any refs for lua_newuserdata() // ... - // ok lua_pushboolean(lua, tb_true); return 1; } else // for stdfile (gc/close) @@ -102,7 +99,6 @@ tb_int_t xm_io_file_close(lua_State *lua) { // gc will free it if no any refs for lua_newuserdata() // ... - // ok lua_pushboolean(lua, tb_true); return 1; } diff --git a/core/src/xmake/io/file_flush.c b/core/src/xmake/io/file_flush.c index 5aa3e9f58..e5776a60e 100644 --- a/core/src/xmake/io/file_flush.c +++ b/core/src/xmake/io/file_flush.c @@ -39,7 +39,6 @@ static tb_bool_t xm_io_std_flush_impl(xm_io_file_t *file) { } static tb_bool_t xm_io_file_flush_impl(xm_io_file_t *file) { - // check tb_assert_and_check_return_val(xm_io_file_is_file(file), tb_false); #ifdef TB_CONFIG_OS_WINDOWS @@ -61,7 +60,6 @@ static tb_bool_t xm_io_file_flush_impl(xm_io_file_t *file) { // io.file_flush(file) tb_int_t xm_io_file_flush(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is user data? diff --git a/core/src/xmake/io/file_isatty.c b/core/src/xmake/io/file_isatty.c index 645431398..264cabd53 100644 --- a/core/src/xmake/io/file_isatty.c +++ b/core/src/xmake/io/file_isatty.c @@ -36,7 +36,6 @@ // io.file_isatty(file) tb_int_t xm_io_file_isatty(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is user data? diff --git a/core/src/xmake/io/file_open.c b/core/src/xmake/io/file_open.c index 56c0848fd..f4a080077 100644 --- a/core/src/xmake/io/file_open.c +++ b/core/src/xmake/io/file_open.c @@ -44,7 +44,6 @@ * private implementation */ static tb_size_t xm_io_file_detect_charset(tb_byte_t const **data_ptr, tb_long_t size) { - // check tb_assert(data_ptr && *data_ptr); tb_byte_t const *data = *data_ptr; @@ -142,7 +141,6 @@ static tb_size_t xm_io_file_detect_charset(tb_byte_t const **data_ptr, tb_long_t return charset; } static tb_size_t xm_io_file_detect_encoding(tb_stream_ref_t stream, tb_long_t *pbomoff) { - // check tb_assert_and_check_return_val(stream && pbomoff, XM_IO_FILE_ENCODING_BINARY); // detect encoding @@ -163,7 +161,6 @@ static tb_size_t xm_io_file_detect_encoding(tb_stream_ref_t stream, tb_long_t *p // io.file_open(path, modestr) tb_int_t xm_io_file_open(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get file path and mode @@ -261,7 +258,6 @@ tb_int_t xm_io_file_open(lua_State *lua) { if (bomoff > 0 && !tb_stream_seek(stream, bomoff)) break; - // ok open_ok = tb_true; } while (0); diff --git a/core/src/xmake/io/file_rawfd.c b/core/src/xmake/io/file_rawfd.c index f4dc3ffee..c94dc4a98 100644 --- a/core/src/xmake/io/file_rawfd.c +++ b/core/src/xmake/io/file_rawfd.c @@ -52,7 +52,6 @@ * e.g. set VS_UNICODE_OUTPUT=fd to enable vs unicode output, @see https://github.com/xmake-io/xmake/issues/528 */ tb_int_t xm_io_file_rawfd(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is user data? diff --git a/core/src/xmake/io/file_read.c b/core/src/xmake/io/file_read.c index 2f349edb5..2be05a05a 100644 --- a/core/src/xmake/io/file_read.c +++ b/core/src/xmake/io/file_read.c @@ -44,7 +44,6 @@ typedef enum __xm_pushline_state_e { * implementation */ static tb_long_t xm_io_file_buffer_readline(tb_stream_ref_t stream, tb_buffer_ref_t line) { - // check tb_assert_and_check_return_val(stream && line, -1); // read line and reserve crlf @@ -79,7 +78,6 @@ static tb_long_t xm_io_file_buffer_readline(tb_stream_ref_t stream, tb_buffer_re } } - // ok? tb_size_t linesize = tb_buffer_size(line); if (linesize) return linesize; @@ -90,7 +88,6 @@ static tb_int_t xm_io_file_buffer_pushline(tb_buffer_ref_t buf, xm_io_file_t *file, tb_char_t const *continuation, tb_bool_t keep_crlf) { - // check tb_assert(buf && file && continuation && xm_io_file_is_file(file) && file->u.file_ref); // is binary? @@ -166,7 +163,6 @@ static tb_int_t xm_io_file_buffer_pushline(tb_buffer_ref_t buf, return result; } static tb_int_t xm_io_file_read_all_directly(lua_State *lua, xm_io_file_t *file) { - // check tb_assert(lua && file && xm_io_file_is_file(file) && file->u.file_ref); // init buffer @@ -201,7 +197,6 @@ static tb_int_t xm_io_file_read_all_directly(lua_State *lua, xm_io_file_t *file) return 1; } static tb_int_t xm_io_file_read_all(lua_State *lua, xm_io_file_t *file, tb_char_t const *continuation) { - // check tb_assert(lua && file && continuation && xm_io_file_is_file(file) && file->u.file_ref); // is binary? read all directly @@ -242,7 +237,6 @@ static tb_int_t xm_io_file_read_line(lua_State *lua, xm_io_file_t *file, tb_char_t const *continuation, tb_bool_t keep_crlf) { - // check tb_assert(lua && file && continuation && xm_io_file_is_file(file) && file->u.file_ref); // init buffer @@ -278,7 +272,6 @@ static tb_int_t xm_io_file_read_line(lua_State *lua, } static tb_int_t xm_io_file_read_n(lua_State *lua, xm_io_file_t *file, tb_char_t const *continuation, tb_long_t n) { - // check tb_assert(lua && file && continuation && xm_io_file_is_file(file) && file->u.file_ref); // check continuation @@ -314,7 +307,6 @@ static tb_size_t xm_io_file_std_buffer_pushline(tb_buffer_ref_t buf, xm_io_file_t *file, tb_char_t const *continuation, tb_bool_t keep_crlf) { - // check tb_assert(buf && file && continuation && xm_io_file_is_std(file)); // get input buffer @@ -367,7 +359,6 @@ static tb_int_t xm_io_file_std_read_line(lua_State *lua, xm_io_file_t *file, tb_char_t const *continuation, tb_bool_t keep_crlf) { - // check tb_assert(lua && file && continuation && xm_io_file_is_std(file)); // init buffer @@ -403,7 +394,6 @@ static tb_int_t xm_io_file_std_read_line(lua_State *lua, } static tb_int_t xm_io_file_std_read_all(lua_State *lua, xm_io_file_t *file, tb_char_t const *continuation) { - // check tb_assert(lua && file && continuation && xm_io_file_is_std(file)); // init buffer @@ -436,7 +426,6 @@ static tb_int_t xm_io_file_std_read_all(lua_State *lua, xm_io_file_t *file, tb_c } static tb_int_t xm_io_file_std_read_n(lua_State *lua, xm_io_file_t *file, tb_char_t const *continuation, tb_long_t n) { - // check tb_assert(lua && file && continuation && xm_io_file_is_std(file)); // check continuation @@ -466,7 +455,6 @@ static tb_int_t xm_io_file_std_read_n(lua_State *lua, xm_io_file_t *file, tb_cha } static tb_int_t xm_io_file_std_read_num(lua_State *lua, xm_io_file_t *file, tb_char_t const *continuation) { - // check tb_assert(lua && file && continuation && xm_io_file_is_std(file)); // check continuation @@ -490,7 +478,6 @@ static tb_int_t xm_io_file_std_read_num(lua_State *lua, xm_io_file_t *file, tb_c * io.file_read(file, 10) */ tb_int_t xm_io_file_read(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is user data? diff --git a/core/src/xmake/io/file_readable.c b/core/src/xmake/io/file_readable.c index e3cca2dc9..5f9a84329 100644 --- a/core/src/xmake/io/file_readable.c +++ b/core/src/xmake/io/file_readable.c @@ -35,7 +35,6 @@ */ tb_int_t xm_io_file_readable(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is user data? diff --git a/core/src/xmake/io/file_seek.c b/core/src/xmake/io/file_seek.c index ea053302b..421e5cdf1 100644 --- a/core/src/xmake/io/file_seek.c +++ b/core/src/xmake/io/file_seek.c @@ -36,7 +36,6 @@ // io.file_seek(file, [whence [, offset]]) tb_int_t xm_io_file_seek(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is user data? diff --git a/core/src/xmake/io/file_size.c b/core/src/xmake/io/file_size.c index df83a96b9..34f519306 100644 --- a/core/src/xmake/io/file_size.c +++ b/core/src/xmake/io/file_size.c @@ -36,7 +36,6 @@ // io.file_size(file) tb_int_t xm_io_file_size(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is user data? diff --git a/core/src/xmake/io/file_write.c b/core/src/xmake/io/file_write.c index bfe7321f3..5f70e1a49 100644 --- a/core/src/xmake/io/file_write.c +++ b/core/src/xmake/io/file_write.c @@ -34,7 +34,6 @@ * private implementation */ static tb_void_t xm_io_file_write_file_utfbom(xm_io_file_t *file) { - // check tb_assert(file && xm_io_file_is_file(file) && file->u.file_ref); // write bom @@ -60,7 +59,6 @@ static tb_void_t xm_io_file_write_file_directly(xm_io_file_t *file, tb_byte_t co tb_stream_bwrit(file->u.file_ref, data, size); } static tb_void_t xm_io_file_write_file_transcrlf(xm_io_file_t *file, tb_byte_t const *data, tb_size_t size) { - // check tb_assert(file && data && xm_io_file_is_file(file) && file->u.file_ref); #ifdef TB_CONFIG_OS_WINDOWS @@ -105,7 +103,6 @@ static tb_void_t xm_io_file_write_file_transcrlf(xm_io_file_t *file, tb_byte_t c #endif } static tb_void_t xm_io_file_write_std(xm_io_file_t *file, tb_byte_t const *data, tb_size_t size) { - // check tb_assert(file && data && xm_io_file_is_std(file)); // check type @@ -122,7 +119,6 @@ static tb_void_t xm_io_file_write_std(xm_io_file_t *file, tb_byte_t const *data, // io.file_write(file, ...) tb_int_t xm_io_file_write(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is user data? diff --git a/core/src/xmake/io/filelock_close.c b/core/src/xmake/io/filelock_close.c index ad628cb5c..02a2fb039 100644 --- a/core/src/xmake/io/filelock_close.c +++ b/core/src/xmake/io/filelock_close.c @@ -36,7 +36,6 @@ // io.filelock_close(lock) tb_int_t xm_io_filelock_close(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check lock? @@ -53,6 +52,5 @@ tb_int_t xm_io_filelock_close(lua_State *lua) { // save result: ok lua_pushboolean(lua, tb_true); - // ok return 1; } diff --git a/core/src/xmake/io/filelock_lock.c b/core/src/xmake/io/filelock_lock.c index 109bb6dcd..9e0c2493e 100644 --- a/core/src/xmake/io/filelock_lock.c +++ b/core/src/xmake/io/filelock_lock.c @@ -40,7 +40,6 @@ * shared lock: io.filelock_lock(lock, "/xxxx/filelock", {shared = true}) */ tb_int_t xm_io_filelock_lock(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get option argument diff --git a/core/src/xmake/io/filelock_open.c b/core/src/xmake/io/filelock_open.c index 171c6c86a..e9687ba54 100644 --- a/core/src/xmake/io/filelock_open.c +++ b/core/src/xmake/io/filelock_open.c @@ -38,7 +38,6 @@ * io.filelock_open(path) */ tb_int_t xm_io_filelock_open(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get file path diff --git a/core/src/xmake/io/filelock_trylock.c b/core/src/xmake/io/filelock_trylock.c index d1a204d30..aaf1da246 100644 --- a/core/src/xmake/io/filelock_trylock.c +++ b/core/src/xmake/io/filelock_trylock.c @@ -40,7 +40,6 @@ * shared lock: io.filelock_trylock("/xxxx/filelock", {shared = true}) */ tb_int_t xm_io_filelock_trylock(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get option argument diff --git a/core/src/xmake/io/filelock_unlock.c b/core/src/xmake/io/filelock_unlock.c index 0eaa2bc98..94dfe1b7d 100644 --- a/core/src/xmake/io/filelock_unlock.c +++ b/core/src/xmake/io/filelock_unlock.c @@ -36,7 +36,6 @@ // io.filelock_unlock(lock) tb_int_t xm_io_filelock_unlock(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check lock? diff --git a/core/src/xmake/io/pipe_close.c b/core/src/xmake/io/pipe_close.c index a3adb6d8c..23e200606 100644 --- a/core/src/xmake/io/pipe_close.c +++ b/core/src/xmake/io/pipe_close.c @@ -36,7 +36,6 @@ // io.pipe_close(pipe) tb_int_t xm_io_pipe_close(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check pipe? diff --git a/core/src/xmake/io/pipe_connect.c b/core/src/xmake/io/pipe_connect.c index 985817386..f13f612f9 100644 --- a/core/src/xmake/io/pipe_connect.c +++ b/core/src/xmake/io/pipe_connect.c @@ -36,7 +36,6 @@ // io.pipe_connect(pipefile) tb_int_t xm_io_pipe_connect(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check pipe diff --git a/core/src/xmake/io/pipe_open.c b/core/src/xmake/io/pipe_open.c index d0dbe66e9..d82406dee 100644 --- a/core/src/xmake/io/pipe_open.c +++ b/core/src/xmake/io/pipe_open.c @@ -38,7 +38,6 @@ * io.pipe_open(name, mode, buffsize) */ tb_int_t xm_io_pipe_open(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get pipe name and mode diff --git a/core/src/xmake/io/pipe_openpair.c b/core/src/xmake/io/pipe_openpair.c index c95d13a62..dd2205613 100644 --- a/core/src/xmake/io/pipe_openpair.c +++ b/core/src/xmake/io/pipe_openpair.c @@ -38,7 +38,6 @@ * io.pipe_openpair(mode, buffsize) */ tb_int_t xm_io_pipe_openpair(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get pipe mode diff --git a/core/src/xmake/io/pipe_read.c b/core/src/xmake/io/pipe_read.c index fb82c1ebd..637fb3b7d 100644 --- a/core/src/xmake/io/pipe_read.c +++ b/core/src/xmake/io/pipe_read.c @@ -36,7 +36,6 @@ // real, data_or_errors = io.pipe_read(pipefile, size) tb_int_t xm_io_pipe_read(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check pipe file diff --git a/core/src/xmake/io/pipe_wait.c b/core/src/xmake/io/pipe_wait.c index 67d189892..785efe950 100644 --- a/core/src/xmake/io/pipe_wait.c +++ b/core/src/xmake/io/pipe_wait.c @@ -36,7 +36,6 @@ // io.pipe_wait(pipefile, events, timeout) tb_int_t xm_io_pipe_wait(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check pipe? diff --git a/core/src/xmake/io/pipe_write.c b/core/src/xmake/io/pipe_write.c index 9b0869299..2f2865c47 100644 --- a/core/src/xmake/io/pipe_write.c +++ b/core/src/xmake/io/pipe_write.c @@ -36,7 +36,6 @@ // io.pipe_write(pipefile, data, start, last) tb_int_t xm_io_pipe_write(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check pipe diff --git a/core/src/xmake/io/poller_insert.c b/core/src/xmake/io/poller_insert.c index 2b24b3b1e..81f66cce9 100644 --- a/core/src/xmake/io/poller_insert.c +++ b/core/src/xmake/io/poller_insert.c @@ -37,7 +37,6 @@ // io.poller_insert(obj:otype(), obj:cdata(), events) tb_int_t xm_io_poller_insert(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/io/poller_modify.c b/core/src/xmake/io/poller_modify.c index 77dff2fbf..f9283aecb 100644 --- a/core/src/xmake/io/poller_modify.c +++ b/core/src/xmake/io/poller_modify.c @@ -37,7 +37,6 @@ // io.poller_modify(obj:otype(), obj:cdata(), events) tb_int_t xm_io_poller_modify(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/io/poller_remove.c b/core/src/xmake/io/poller_remove.c index 34242808f..3127bf2b4 100644 --- a/core/src/xmake/io/poller_remove.c +++ b/core/src/xmake/io/poller_remove.c @@ -37,7 +37,6 @@ // io.poller_remove(obj:otype(), obj) tb_int_t xm_io_poller_remove(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/io/poller_spank.c b/core/src/xmake/io/poller_spank.c index 1656a537e..7fdb38605 100644 --- a/core/src/xmake/io/poller_spank.c +++ b/core/src/xmake/io/poller_spank.c @@ -37,7 +37,6 @@ // io.poller_spank() tb_int_t xm_io_poller_spank(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // spank the poller, break the tb_poller_wait() and return all events diff --git a/core/src/xmake/io/poller_support.c b/core/src/xmake/io/poller_support.c index d53cdc1ed..d63f8da34 100644 --- a/core/src/xmake/io/poller_support.c +++ b/core/src/xmake/io/poller_support.c @@ -37,7 +37,6 @@ // io.poller_support(events) tb_int_t xm_io_poller_support(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get events diff --git a/core/src/xmake/io/poller_wait.c b/core/src/xmake/io/poller_wait.c index 141c4640b..f1e4ed7a7 100644 --- a/core/src/xmake/io/poller_wait.c +++ b/core/src/xmake/io/poller_wait.c @@ -38,7 +38,6 @@ static tb_void_t xm_io_poller_event(tb_poller_ref_t poller, tb_poller_object_ref_t object, tb_long_t events, tb_cpointer_t priv) { - // check xm_poller_state_t *state = (xm_poller_state_t *)tb_poller_priv(poller); tb_assert_and_check_return(state && state->lua); @@ -76,7 +75,6 @@ static tb_void_t xm_io_poller_event(tb_poller_ref_t poller, // local events, count = io.poller_wait(timeout) tb_int_t xm_io_poller_wait(lua_State *lua) { - // check tb_poller_ref_t poller = xm_io_poller(lua); tb_assert_and_check_return_val(poller && lua, 0); @@ -101,7 +99,6 @@ tb_int_t xm_io_poller_wait(lua_State *lua) { return 2; } - // failed lua_pop(lua, 1); lua_pushnil(lua); lua_pushinteger(lua, -1); diff --git a/core/src/xmake/io/socket_accept.c b/core/src/xmake/io/socket_accept.c index 5a303ef74..77a6c6c86 100644 --- a/core/src/xmake/io/socket_accept.c +++ b/core/src/xmake/io/socket_accept.c @@ -36,7 +36,6 @@ // local sock = io.socket_accept(sock) tb_int_t xm_io_socket_accept(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/io/socket_bind.c b/core/src/xmake/io/socket_bind.c index 9ba441a6f..d1a30789a 100644 --- a/core/src/xmake/io/socket_bind.c +++ b/core/src/xmake/io/socket_bind.c @@ -36,7 +36,6 @@ // io.socket_bind(sock, addr, port, family) tb_int_t xm_io_socket_bind(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check socket diff --git a/core/src/xmake/io/socket_close.c b/core/src/xmake/io/socket_close.c index d53228fe7..922987c10 100644 --- a/core/src/xmake/io/socket_close.c +++ b/core/src/xmake/io/socket_close.c @@ -36,7 +36,6 @@ // io.socket_close(sock) tb_int_t xm_io_socket_close(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/io/socket_connect.c b/core/src/xmake/io/socket_connect.c index 63d355fb4..94c2f1e8d 100644 --- a/core/src/xmake/io/socket_connect.c +++ b/core/src/xmake/io/socket_connect.c @@ -36,7 +36,6 @@ // io.socket_connect(sock, addr, port, family) tb_int_t xm_io_socket_connect(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check socket diff --git a/core/src/xmake/io/socket_ctrl.c b/core/src/xmake/io/socket_ctrl.c index c16f2c20d..0a51d65bc 100644 --- a/core/src/xmake/io/socket_ctrl.c +++ b/core/src/xmake/io/socket_ctrl.c @@ -36,7 +36,6 @@ // io.socket_ctrl(sock, code, value) tb_int_t xm_io_socket_ctrl(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check socket diff --git a/core/src/xmake/io/socket_kill.c b/core/src/xmake/io/socket_kill.c index eb2956e53..63e110257 100644 --- a/core/src/xmake/io/socket_kill.c +++ b/core/src/xmake/io/socket_kill.c @@ -36,7 +36,6 @@ // local sock = io.socket_kill(sock) tb_int_t xm_io_socket_kill(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/io/socket_listen.c b/core/src/xmake/io/socket_listen.c index 6fece6087..3aa541016 100644 --- a/core/src/xmake/io/socket_listen.c +++ b/core/src/xmake/io/socket_listen.c @@ -36,7 +36,6 @@ // io.socket_listen(sock, backlog) tb_int_t xm_io_socket_listen(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/io/socket_open.c b/core/src/xmake/io/socket_open.c index 4189607c7..cae80d182 100644 --- a/core/src/xmake/io/socket_open.c +++ b/core/src/xmake/io/socket_open.c @@ -38,7 +38,6 @@ * io.socket_open(socktype, family) */ tb_int_t xm_io_socket_open(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get socket type diff --git a/core/src/xmake/io/socket_peeraddr.c b/core/src/xmake/io/socket_peeraddr.c index bcc03c289..e1ad43931 100644 --- a/core/src/xmake/io/socket_peeraddr.c +++ b/core/src/xmake/io/socket_peeraddr.c @@ -44,7 +44,6 @@ /* io.socket_peeraddr(sock) */ tb_int_t xm_io_socket_peeraddr(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/io/socket_rawfd.c b/core/src/xmake/io/socket_rawfd.c index 672a9dafa..6340c0c19 100644 --- a/core/src/xmake/io/socket_rawfd.c +++ b/core/src/xmake/io/socket_rawfd.c @@ -44,7 +44,6 @@ /* io.socket_rawfd(sock) */ tb_int_t xm_io_socket_rawfd(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/io/socket_recv.c b/core/src/xmake/io/socket_recv.c index cecdbb031..ed629a8f5 100644 --- a/core/src/xmake/io/socket_recv.c +++ b/core/src/xmake/io/socket_recv.c @@ -36,7 +36,6 @@ // real, data_or_errors = io.socket_recv(sock, size) tb_int_t xm_io_socket_recv(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check socket diff --git a/core/src/xmake/io/socket_recvfrom.c b/core/src/xmake/io/socket_recvfrom.c index bc8f53bf8..8601f6302 100644 --- a/core/src/xmake/io/socket_recvfrom.c +++ b/core/src/xmake/io/socket_recvfrom.c @@ -36,7 +36,6 @@ // real, data_or_errors, addr, port = io.socket_recvfrom(sock, size) tb_int_t xm_io_socket_recvfrom(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check socket diff --git a/core/src/xmake/io/socket_send.c b/core/src/xmake/io/socket_send.c index 1b99d8d08..d83b02add 100644 --- a/core/src/xmake/io/socket_send.c +++ b/core/src/xmake/io/socket_send.c @@ -36,7 +36,6 @@ // io.socket_send(sock, data, start, last) tb_int_t xm_io_socket_send(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check socket diff --git a/core/src/xmake/io/socket_sendfile.c b/core/src/xmake/io/socket_sendfile.c index b5e6e10d6..0d4be4219 100644 --- a/core/src/xmake/io/socket_sendfile.c +++ b/core/src/xmake/io/socket_sendfile.c @@ -36,7 +36,6 @@ // io.socket_sendfile(sock, file, start, last) tb_int_t xm_io_socket_sendfile(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check socket diff --git a/core/src/xmake/io/socket_sendto.c b/core/src/xmake/io/socket_sendto.c index cde81febf..15403d4d8 100644 --- a/core/src/xmake/io/socket_sendto.c +++ b/core/src/xmake/io/socket_sendto.c @@ -36,7 +36,6 @@ // io.socket_sendto(sock, data, addr, port) tb_int_t xm_io_socket_sendto(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check socket diff --git a/core/src/xmake/io/socket_wait.c b/core/src/xmake/io/socket_wait.c index fd9900e21..42674f4f9 100644 --- a/core/src/xmake/io/socket_wait.c +++ b/core/src/xmake/io/socket_wait.c @@ -36,7 +36,6 @@ // io.socket_wait(sock, events, timeout) tb_int_t xm_io_socket_wait(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check socket? diff --git a/core/src/xmake/io/stdfile.c b/core/src/xmake/io/stdfile.c index 05e1fcf2a..0dcb43501 100644 --- a/core/src/xmake/io/stdfile.c +++ b/core/src/xmake/io/stdfile.c @@ -144,7 +144,6 @@ static xm_io_file_t *xm_io_stdfile_new(lua_State *lua, tb_size_t type) { // io.stdfile(stdin: 1, stdout: 2, stderr: 3) tb_int_t xm_io_stdfile(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get std type diff --git a/core/src/xmake/libc/byteof.c b/core/src/xmake/libc/byteof.c index be8820ff9..dac772e9b 100644 --- a/core/src/xmake/libc/byteof.c +++ b/core/src/xmake/libc/byteof.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_libc_byteof(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get data diff --git a/core/src/xmake/libc/dataptr.c b/core/src/xmake/libc/dataptr.c index 50b063b4e..363853800 100644 --- a/core/src/xmake/libc/dataptr.c +++ b/core/src/xmake/libc/dataptr.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_libc_dataptr(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); tb_pointer_t data = tb_null; diff --git a/core/src/xmake/libc/free.c b/core/src/xmake/libc/free.c index ad12ccfc9..6f0d70f3d 100644 --- a/core/src/xmake/libc/free.c +++ b/core/src/xmake/libc/free.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_libc_free(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // do free diff --git a/core/src/xmake/libc/malloc.c b/core/src/xmake/libc/malloc.c index 8e2380955..faaa00e97 100644 --- a/core/src/xmake/libc/malloc.c +++ b/core/src/xmake/libc/malloc.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_libc_malloc(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // do malloc diff --git a/core/src/xmake/libc/memcpy.c b/core/src/xmake/libc/memcpy.c index 6baf66d39..e0e8b1492 100644 --- a/core/src/xmake/libc/memcpy.c +++ b/core/src/xmake/libc/memcpy.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_libc_memcpy(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // do memcpy diff --git a/core/src/xmake/libc/memmov.c b/core/src/xmake/libc/memmov.c index f43bccea6..66120e168 100644 --- a/core/src/xmake/libc/memmov.c +++ b/core/src/xmake/libc/memmov.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_libc_memmov(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // do memmov diff --git a/core/src/xmake/libc/memset.c b/core/src/xmake/libc/memset.c index 2c0936017..4f8864842 100644 --- a/core/src/xmake/libc/memset.c +++ b/core/src/xmake/libc/memset.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_libc_memset(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // do memset diff --git a/core/src/xmake/libc/setbyte.c b/core/src/xmake/libc/setbyte.c index 7ae959014..d53c30229 100644 --- a/core/src/xmake/libc/setbyte.c +++ b/core/src/xmake/libc/setbyte.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_libc_setbyte(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get data diff --git a/core/src/xmake/libc/strndup.c b/core/src/xmake/libc/strndup.c index d7d1204a0..f61cebb2c 100644 --- a/core/src/xmake/libc/strndup.c +++ b/core/src/xmake/libc/strndup.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_libc_strndup(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // do strndup diff --git a/core/src/xmake/lz4/block_compress.c b/core/src/xmake/lz4/block_compress.c index 2c7f0c00f..53b592a22 100644 --- a/core/src/xmake/lz4/block_compress.c +++ b/core/src/xmake/lz4/block_compress.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_lz4_block_compress(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get data and size diff --git a/core/src/xmake/lz4/block_decompress.c b/core/src/xmake/lz4/block_decompress.c index f2f76a4bf..2a6ed1d20 100644 --- a/core/src/xmake/lz4/block_decompress.c +++ b/core/src/xmake/lz4/block_decompress.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_lz4_block_decompress(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get data and size diff --git a/core/src/xmake/lz4/compress.c b/core/src/xmake/lz4/compress.c index 352945d1f..69af51113 100644 --- a/core/src/xmake/lz4/compress.c +++ b/core/src/xmake/lz4/compress.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_lz4_compress(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get data and size diff --git a/core/src/xmake/lz4/compress_file.c b/core/src/xmake/lz4/compress_file.c index be48184bd..48596e17b 100644 --- a/core/src/xmake/lz4/compress_file.c +++ b/core/src/xmake/lz4/compress_file.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_lz4_compress_file(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the file paths @@ -91,7 +90,6 @@ tb_int_t xm_lz4_compress_file(lua_State *lua) { } xm_lz4_cstream_exit(stream_lz4); - // ok? lua_pushboolean(lua, ok); return 1; } diff --git a/core/src/xmake/lz4/compress_stream_close.c b/core/src/xmake/lz4/compress_stream_close.c index 2bec169d0..d1f534cde 100644 --- a/core/src/xmake/lz4/compress_stream_close.c +++ b/core/src/xmake/lz4/compress_stream_close.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_lz4_compress_stream_close(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/lz4/compress_stream_open.c b/core/src/xmake/lz4/compress_stream_open.c index e4fd1de8b..d4ac50667 100644 --- a/core/src/xmake/lz4/compress_stream_open.c +++ b/core/src/xmake/lz4/compress_stream_open.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_lz4_compress_stream_open(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); xm_lz4_cstream_t *stream = xm_lz4_cstream_init(); diff --git a/core/src/xmake/lz4/compress_stream_read.c b/core/src/xmake/lz4/compress_stream_read.c index 7338ede02..ff1315c3e 100644 --- a/core/src/xmake/lz4/compress_stream_read.c +++ b/core/src/xmake/lz4/compress_stream_read.c @@ -35,7 +35,6 @@ */ tb_int_t xm_lz4_compress_stream_read(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check handle diff --git a/core/src/xmake/lz4/compress_stream_write.c b/core/src/xmake/lz4/compress_stream_write.c index aa6b87e85..730a4f986 100644 --- a/core/src/xmake/lz4/compress_stream_write.c +++ b/core/src/xmake/lz4/compress_stream_write.c @@ -35,7 +35,6 @@ */ tb_int_t xm_lz4_compress_stream_write(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check handle diff --git a/core/src/xmake/lz4/decompress.c b/core/src/xmake/lz4/decompress.c index c5382747d..51a50c112 100644 --- a/core/src/xmake/lz4/decompress.c +++ b/core/src/xmake/lz4/decompress.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_lz4_decompress(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get data and size diff --git a/core/src/xmake/lz4/decompress_file.c b/core/src/xmake/lz4/decompress_file.c index b65ee87a0..7d91c5be4 100644 --- a/core/src/xmake/lz4/decompress_file.c +++ b/core/src/xmake/lz4/decompress_file.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_lz4_decompress_file(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the file paths @@ -91,7 +90,6 @@ tb_int_t xm_lz4_decompress_file(lua_State *lua) { } xm_lz4_dstream_exit(stream_lz4); - // ok? lua_pushboolean(lua, ok); return 1; } diff --git a/core/src/xmake/lz4/decompress_stream_close.c b/core/src/xmake/lz4/decompress_stream_close.c index ead2e3493..89c868c53 100644 --- a/core/src/xmake/lz4/decompress_stream_close.c +++ b/core/src/xmake/lz4/decompress_stream_close.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_lz4_decompress_stream_close(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/lz4/decompress_stream_open.c b/core/src/xmake/lz4/decompress_stream_open.c index 673038e80..eb3db7193 100644 --- a/core/src/xmake/lz4/decompress_stream_open.c +++ b/core/src/xmake/lz4/decompress_stream_open.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_lz4_decompress_stream_open(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); xm_lz4_dstream_t *stream = xm_lz4_dstream_init(); diff --git a/core/src/xmake/lz4/decompress_stream_read.c b/core/src/xmake/lz4/decompress_stream_read.c index 5f6486166..85ecdbe9f 100644 --- a/core/src/xmake/lz4/decompress_stream_read.c +++ b/core/src/xmake/lz4/decompress_stream_read.c @@ -35,7 +35,6 @@ */ tb_int_t xm_lz4_decompress_stream_read(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check handle diff --git a/core/src/xmake/lz4/decompress_stream_write.c b/core/src/xmake/lz4/decompress_stream_write.c index 7fa45544c..4359a41d7 100644 --- a/core/src/xmake/lz4/decompress_stream_write.c +++ b/core/src/xmake/lz4/decompress_stream_write.c @@ -35,7 +35,6 @@ */ tb_int_t xm_lz4_decompress_stream_write(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check handle diff --git a/core/src/xmake/lz4/prefix.h b/core/src/xmake/lz4/prefix.h index 996e53093..534e5361a 100644 --- a/core/src/xmake/lz4/prefix.h +++ b/core/src/xmake/lz4/prefix.h @@ -131,7 +131,6 @@ static __tb_inline__ tb_long_t xm_lz4_cstream_write(xm_lz4_cstream_t *stream, tb_byte_t const *idata, tb_size_t isize, tb_bool_t end) { - // check tb_assert_and_check_return_val(stream && stream->cctx && idata && isize, -1); tb_assert_and_check_return_val(isize <= stream->write_maxn, -1); tb_assert_and_check_return_val(stream->buffer_size + isize < stream->buffer_maxn, -1); @@ -162,7 +161,6 @@ static __tb_inline__ tb_long_t xm_lz4_cstream_write(xm_lz4_cstream_t *stream, } static __tb_inline__ tb_long_t xm_lz4_cstream_read(xm_lz4_cstream_t *stream, tb_byte_t *odata, tb_size_t osize) { - // check tb_assert_and_check_return_val(stream && stream->cctx && odata && osize, -1); tb_assert_and_check_return_val(osize >= stream->header_size, -1); @@ -224,7 +222,6 @@ static __tb_inline__ tb_long_t xm_lz4_dstream_write(xm_lz4_dstream_t *stream, tb_byte_t const *idata, tb_size_t isize, tb_bool_t end) { - // check tb_assert_and_check_return_val(stream && stream->dctx && idata && isize, -1); // read header first @@ -279,7 +276,6 @@ static __tb_inline__ tb_long_t xm_lz4_dstream_write(xm_lz4_dstream_t *stream, } static __tb_inline__ tb_long_t xm_lz4_dstream_read(xm_lz4_dstream_t *stream, tb_byte_t *odata, tb_size_t osize) { - // check tb_assert_and_check_return_val(stream && stream->dctx && stream->buffer && odata && osize, -1); tb_check_return_val(stream->buffer_size, 0); diff --git a/core/src/xmake/os/args.c b/core/src/xmake/os/args.c index d220e0350..8b2c002c9 100644 --- a/core/src/xmake/os/args.c +++ b/core/src/xmake/os/args.c @@ -35,7 +35,6 @@ */ static tb_void_t tb_os_args_append( tb_string_ref_t result, tb_char_t const *cstr, tb_size_t size, tb_bool_t escape, tb_bool_t nowrap) { - // check tb_assert_and_check_return(size < TB_PATH_MAXN); // need wrap quote? @@ -74,7 +73,6 @@ static tb_void_t tb_os_args_append( */ // os.args({"xx", "yy"}, {escape = true}) tb_int_t xm_os_args(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // escape '\\' characters in global? diff --git a/core/src/xmake/os/argv.c b/core/src/xmake/os/argv.c index 89635fb2d..f7230d057 100644 --- a/core/src/xmake/os/argv.c +++ b/core/src/xmake/os/argv.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_argv(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the argument string diff --git a/core/src/xmake/os/chdir.c b/core/src/xmake/os/chdir.c index 537d6506c..73619122c 100644 --- a/core/src/xmake/os/chdir.c +++ b/core/src/xmake/os/chdir.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_chdir(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path @@ -44,6 +43,5 @@ tb_int_t xm_os_chdir(lua_State *lua) { // done os.chdir(path) lua_pushboolean(lua, tb_directory_current_set(path)); - // ok return 1; } diff --git a/core/src/xmake/os/cpdir.c b/core/src/xmake/os/cpdir.c index e2f2b89ee..0df435436 100644 --- a/core/src/xmake/os/cpdir.c +++ b/core/src/xmake/os/cpdir.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_cpdir(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the source and destination diff --git a/core/src/xmake/os/cpfile.c b/core/src/xmake/os/cpfile.c index b6597f87f..7291385a7 100644 --- a/core/src/xmake/os/cpfile.c +++ b/core/src/xmake/os/cpfile.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_cpfile(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the source and destination diff --git a/core/src/xmake/os/cpuinfo.c b/core/src/xmake/os/cpuinfo.c index a2ac1bbe4..f8ef7d46b 100644 --- a/core/src/xmake/os/cpuinfo.c +++ b/core/src/xmake/os/cpuinfo.c @@ -237,7 +237,6 @@ static tb_float_t xm_os_cpuinfo_usagerate() { * } */ tb_int_t xm_os_cpuinfo(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // init table diff --git a/core/src/xmake/os/curdir.c b/core/src/xmake/os/curdir.c index b2ca8a273..2d27cf905 100644 --- a/core/src/xmake/os/curdir.c +++ b/core/src/xmake/os/curdir.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_curdir(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // os.curdir() diff --git a/core/src/xmake/os/emptydir.c b/core/src/xmake/os/emptydir.c index 79ebd9807..aab016d28 100644 --- a/core/src/xmake/os/emptydir.c +++ b/core/src/xmake/os/emptydir.c @@ -34,7 +34,6 @@ * private implementation */ static tb_long_t xm_os_emptydir_walk(tb_char_t const *path, tb_file_info_t const *info, tb_cpointer_t priv) { - // check tb_bool_t *is_emptydir = (tb_bool_t *)priv; tb_assert_and_check_return_val(path && info && is_emptydir, TB_DIRECTORY_WALK_CODE_END); @@ -50,7 +49,6 @@ static tb_long_t xm_os_emptydir_walk(tb_char_t const *path, tb_file_info_t const * implementation */ tb_int_t xm_os_emptydir(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the directory diff --git a/core/src/xmake/os/exists.c b/core/src/xmake/os/exists.c index 403a1285d..9bb244510 100644 --- a/core/src/xmake/os/exists.c +++ b/core/src/xmake/os/exists.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_exists(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path diff --git a/core/src/xmake/os/filesize.c b/core/src/xmake/os/filesize.c index 115ab5665..a99651fbf 100644 --- a/core/src/xmake/os/filesize.c +++ b/core/src/xmake/os/filesize.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_filesize(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path diff --git a/core/src/xmake/os/find.c b/core/src/xmake/os/find.c index 91c5b0261..2ed5611ad 100644 --- a/core/src/xmake/os/find.c +++ b/core/src/xmake/os/find.c @@ -34,7 +34,6 @@ * private implementation */ static tb_long_t xm_os_find_walk(tb_char_t const *path, tb_file_info_t const *info, tb_cpointer_t priv) { - // check tb_value_ref_t tuple = (tb_value_ref_t)priv; tb_assert_and_check_return_val(path && info && tuple, TB_DIRECTORY_WALK_CODE_END); @@ -56,7 +55,6 @@ static tb_long_t xm_os_find_walk(tb_char_t const *path, tb_file_info_t const *in // the count tb_size_t *pcount = &(tuple[3].ul); - // trace tb_trace_d("path[%c]: %s", info->type == TB_FILE_TYPE_DIRECTORY ? 'd' : 'f', path); // we can ignore it directly if this path is file, but we need directory @@ -70,7 +68,6 @@ static tb_long_t xm_os_find_walk(tb_char_t const *path, tb_file_info_t const *in lua_pushstring(lua, path); lua_pushstring(lua, pattern); if (lua_pcall(lua, 2, 1, 0)) { - // trace tb_printf("error: call string.match(%s, %s) failed: %s!\n", path, pattern, lua_tostring(lua, -1)); return TB_DIRECTORY_WALK_CODE_END; } @@ -87,7 +84,6 @@ static tb_long_t xm_os_find_walk(tb_char_t const *path, tb_file_info_t const *in tb_char_t const *rootdir = luaL_checklstring(lua, 1, &rootlen); tb_assert_and_check_return_val(rootdir && rootlen, TB_DIRECTORY_WALK_CODE_END); - // check tb_assert(!tb_strncmp(path, rootdir, rootlen)); tb_assert(rootlen + 1 <= tb_strlen(path)); @@ -108,7 +104,6 @@ static tb_long_t xm_os_find_walk(tb_char_t const *path, tb_file_info_t const *in lua_pushstring(lua, path); lua_pushstring(lua, exclude); if (lua_pcall(lua, 2, 1, 0)) { - // trace tb_printf("error: call string.match(%s, %s) failed: %s!\n", path, exclude, @@ -163,7 +158,6 @@ static tb_long_t xm_os_find_walk(tb_char_t const *path, tb_file_info_t const *in * implementation */ tb_int_t xm_os_find(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the root directory diff --git a/core/src/xmake/os/fscase.c b/core/src/xmake/os/fscase.c index 6fa1c1c4a..b24a36e50 100644 --- a/core/src/xmake/os/fscase.c +++ b/core/src/xmake/os/fscase.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_fscase(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); #if ((TB_VERSION_MAJOR * 100) + (TB_VERSION_MINOR * 10) + TB_VERSION_ALTER) >= 174 diff --git a/core/src/xmake/os/getenv.c b/core/src/xmake/os/getenv.c index 84411ae1a..dc5578ebe 100644 --- a/core/src/xmake/os/getenv.c +++ b/core/src/xmake/os/getenv.c @@ -45,7 +45,6 @@ * implementation */ tb_int_t xm_os_getenv(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the name @@ -89,6 +88,5 @@ tb_int_t xm_os_getenv(lua_State *lua) { // exit values tb_string_exit(&values); - // ok return 1; } diff --git a/core/src/xmake/os/getenvs.c b/core/src/xmake/os/getenvs.c index a3bc546b4..70c6af7bf 100644 --- a/core/src/xmake/os/getenvs.c +++ b/core/src/xmake/os/getenvs.c @@ -57,7 +57,6 @@ extern tb_char_t **environ; * implementation */ static tb_void_t xm_os_getenvs_trim(tb_char_t const **sstr, tb_char_t const **estr) { - // check tb_assert(sstr && estr && *sstr && *estr); tb_char_t const *p = *sstr; @@ -77,7 +76,6 @@ static tb_void_t xm_os_getenvs_trim(tb_char_t const **sstr, tb_char_t const **es } static tb_void_t xm_os_getenvs_process_line(lua_State *lua, tb_char_t const *line) { - // check tb_assert_and_check_return(lua && line); tb_size_t n = tb_strlen(line); @@ -124,7 +122,6 @@ static tb_void_t xm_os_getenvs_process_line(lua_State *lua, tb_char_t const *lin } tb_int_t xm_os_getenvs(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // init table diff --git a/core/src/xmake/os/getown.c b/core/src/xmake/os/getown.c index 54e2b589e..ef7846ad1 100644 --- a/core/src/xmake/os/getown.c +++ b/core/src/xmake/os/getown.c @@ -42,7 +42,6 @@ // get owner by a given path tb_int_t xm_os_getown(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the pathname @@ -63,7 +62,6 @@ tb_int_t xm_os_getown(lua_State *lua) { lua_pushinteger(lua, sts.st_gid); lua_settable(lua, -3); - // ok return 1; } diff --git a/core/src/xmake/os/getpid.c b/core/src/xmake/os/getpid.c index 70b63804a..ad1a6f880 100644 --- a/core/src/xmake/os/getpid.c +++ b/core/src/xmake/os/getpid.c @@ -40,7 +40,6 @@ * implementation */ tb_int_t xm_os_getpid(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); #ifdef TB_CONFIG_OS_WINDOWS diff --git a/core/src/xmake/os/getwinsize.c b/core/src/xmake/os/getwinsize.c index 9757867a9..6faef97d0 100644 --- a/core/src/xmake/os/getwinsize.c +++ b/core/src/xmake/os/getwinsize.c @@ -43,7 +43,6 @@ // get console window size tb_int_t xm_os_getwinsize(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // init default window size (we will not consider winsize limit if cannot get it) @@ -80,6 +79,5 @@ tb_int_t xm_os_getwinsize(lua_State *lua) { lua_pushinteger(lua, h); lua_settable(lua, -3); - // ok return 1; } diff --git a/core/src/xmake/os/gid.c b/core/src/xmake/os/gid.c index cd5915cd4..feb13791b 100644 --- a/core/src/xmake/os/gid.c +++ b/core/src/xmake/os/gid.c @@ -41,7 +41,6 @@ // get & set gid tb_int_t xm_os_gid(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); tb_int_t rgidset = -1; @@ -124,7 +123,6 @@ tb_int_t xm_os_gid(lua_State *lua) { lua_pushinteger(lua, egid); lua_settable(lua, -3); - // ok return 1; } diff --git a/core/src/xmake/os/isdir.c b/core/src/xmake/os/isdir.c index 6126ed6a8..f182e029d 100644 --- a/core/src/xmake/os/isdir.c +++ b/core/src/xmake/os/isdir.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_isdir(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path diff --git a/core/src/xmake/os/isfile.c b/core/src/xmake/os/isfile.c index f015b5f59..d7b1d66f2 100644 --- a/core/src/xmake/os/isfile.c +++ b/core/src/xmake/os/isfile.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_isfile(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path diff --git a/core/src/xmake/os/islink.c b/core/src/xmake/os/islink.c index 2de7e24fd..51181ecd2 100644 --- a/core/src/xmake/os/islink.c +++ b/core/src/xmake/os/islink.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_islink(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path diff --git a/core/src/xmake/os/link.c b/core/src/xmake/os/link.c index 696355177..cead7f88c 100644 --- a/core/src/xmake/os/link.c +++ b/core/src/xmake/os/link.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_link(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the source and destination @@ -45,6 +44,5 @@ tb_int_t xm_os_link(lua_State *lua) { // do os.link(src, dst) lua_pushboolean(lua, tb_file_link(src, dst)); - // ok return 1; } diff --git a/core/src/xmake/os/mclock.c b/core/src/xmake/os/mclock.c index f6bc138d3..5fa440db6 100644 --- a/core/src/xmake/os/mclock.c +++ b/core/src/xmake/os/mclock.c @@ -36,12 +36,10 @@ // os.mclock() tb_int_t xm_os_mclock(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // save result lua_pushnumber(lua, (lua_Number)tb_mclock()); - // ok return 1; } diff --git a/core/src/xmake/os/meminfo.c b/core/src/xmake/os/meminfo.c index 3c0b71d80..1e6e5f422 100644 --- a/core/src/xmake/os/meminfo.c +++ b/core/src/xmake/os/meminfo.c @@ -159,7 +159,6 @@ static tb_bool_t xm_os_meminfo_stats(tb_int_t *ptotalsize, tb_int_t *pavailsize) * implementation */ tb_int_t xm_os_meminfo(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // init table diff --git a/core/src/xmake/os/mkdir.c b/core/src/xmake/os/mkdir.c index badc50fd6..19507b5aa 100644 --- a/core/src/xmake/os/mkdir.c +++ b/core/src/xmake/os/mkdir.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_mkdir(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path @@ -48,6 +47,5 @@ tb_int_t xm_os_mkdir(lua_State *lua) { else lua_pushboolean(lua, tb_true); - // ok return 1; } diff --git a/core/src/xmake/os/mtime.c b/core/src/xmake/os/mtime.c index a3d9c44de..73014666b 100644 --- a/core/src/xmake/os/mtime.c +++ b/core/src/xmake/os/mtime.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_mtime(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path diff --git a/core/src/xmake/os/readlink.c b/core/src/xmake/os/readlink.c index 26ef78819..603ab7104 100644 --- a/core/src/xmake/os/readlink.c +++ b/core/src/xmake/os/readlink.c @@ -37,7 +37,6 @@ * implementation */ tb_int_t xm_os_readlink(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path @@ -69,6 +68,5 @@ tb_int_t xm_os_readlink(lua_State *lua) { lua_pushnil(lua); #endif - // ok return 1; } diff --git a/core/src/xmake/os/rename.c b/core/src/xmake/os/rename.c index 2f43797db..0cc469ded 100644 --- a/core/src/xmake/os/rename.c +++ b/core/src/xmake/os/rename.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_rename(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the source and destination diff --git a/core/src/xmake/os/rmdir.c b/core/src/xmake/os/rmdir.c index dd549adac..f04ba2a9c 100644 --- a/core/src/xmake/os/rmdir.c +++ b/core/src/xmake/os/rmdir.c @@ -34,7 +34,6 @@ * private implementation */ static tb_long_t xm_os_rmdir_empty(tb_char_t const *path, tb_file_info_t const *info, tb_cpointer_t priv) { - // check tb_bool_t *is_emptydir = (tb_bool_t *)priv; tb_assert_and_check_return_val(path && info && is_emptydir, TB_DIRECTORY_WALK_CODE_END); @@ -47,7 +46,6 @@ static tb_long_t xm_os_rmdir_empty(tb_char_t const *path, tb_file_info_t const * return TB_DIRECTORY_WALK_CODE_CONTINUE; } static tb_long_t xm_os_rmdir_remove(tb_char_t const *path, tb_file_info_t const *info, tb_cpointer_t priv) { - // check tb_assert_and_check_return_val(path, TB_DIRECTORY_WALK_CODE_END); // is directory? @@ -56,7 +54,6 @@ static tb_long_t xm_os_rmdir_remove(tb_char_t const *path, tb_file_info_t const tb_bool_t is_emptydir = tb_true; tb_directory_walk(path, tb_false, tb_true, xm_os_rmdir_empty, &is_emptydir); - // trace tb_trace_d("path: %s, emptydir: %u", path, is_emptydir); // remove empty directory @@ -70,7 +67,6 @@ static tb_long_t xm_os_rmdir_remove(tb_char_t const *path, tb_file_info_t const * implementation */ tb_int_t xm_os_rmdir(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path @@ -89,10 +85,8 @@ tb_int_t xm_os_rmdir(lua_State *lua) { if (is_emptydir) tb_directory_remove(path); - // trace tb_trace_d("path: %s, emptydir: %u", path, is_emptydir); - // ok? lua_pushboolean(lua, !tb_file_info(path, tb_null)); } else { // os.rmdir(path) diff --git a/core/src/xmake/os/rmfile.c b/core/src/xmake/os/rmfile.c index f4b204e25..2032d4ee2 100644 --- a/core/src/xmake/os/rmfile.c +++ b/core/src/xmake/os/rmfile.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_rmfile(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path diff --git a/core/src/xmake/os/setenv.c b/core/src/xmake/os/setenv.c index 99a9bf44e..be375b2f4 100644 --- a/core/src/xmake/os/setenv.c +++ b/core/src/xmake/os/setenv.c @@ -35,7 +35,6 @@ */ // ok = os.setenv(name, value) tb_int_t xm_os_setenv(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the name and value diff --git a/core/src/xmake/os/signal.c b/core/src/xmake/os/signal.c index c1f43ad6b..4d9e8a4c5 100644 --- a/core/src/xmake/os/signal.c +++ b/core/src/xmake/os/signal.c @@ -101,7 +101,6 @@ static tb_void_t xm_os_signal_handler(tb_int_t signo_native) { * implementation */ tb_int_t xm_os_signal(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); g_lua = lua; tb_int_t handler = XM_OS_SIGFUN; diff --git a/core/src/xmake/os/strerror.c b/core/src/xmake/os/strerror.c index 955ca8e24..c1ae41039 100644 --- a/core/src/xmake/os/strerror.c +++ b/core/src/xmake/os/strerror.c @@ -40,7 +40,6 @@ * implementation */ tb_int_t xm_os_strerror(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get syserror state diff --git a/core/src/xmake/os/syserror.c b/core/src/xmake/os/syserror.c index b96a9894f..3ef2a5c52 100644 --- a/core/src/xmake/os/syserror.c +++ b/core/src/xmake/os/syserror.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_syserror(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get syserror state diff --git a/core/src/xmake/os/tmpdir.c b/core/src/xmake/os/tmpdir.c index 68b99ee8f..4396603d4 100644 --- a/core/src/xmake/os/tmpdir.c +++ b/core/src/xmake/os/tmpdir.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_tmpdir(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // os.tmpdir() diff --git a/core/src/xmake/os/touch.c b/core/src/xmake/os/touch.c index 4e0bd5af8..5c470440b 100644 --- a/core/src/xmake/os/touch.c +++ b/core/src/xmake/os/touch.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_os_touch(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); tb_char_t const *path = luaL_checkstring(lua, 1); diff --git a/core/src/xmake/os/uid.c b/core/src/xmake/os/uid.c index b6413a5e5..2785437d0 100644 --- a/core/src/xmake/os/uid.c +++ b/core/src/xmake/os/uid.c @@ -41,7 +41,6 @@ // get & set uid tb_int_t xm_os_uid(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); tb_int_t ruidset = -1; @@ -124,7 +123,6 @@ tb_int_t xm_os_uid(lua_State *lua) { lua_pushinteger(lua, euid); lua_settable(lua, -3); - // ok return 1; } diff --git a/core/src/xmake/package/loadxmi.c b/core/src/xmake/package/loadxmi.c index 894141414..15a579f91 100644 --- a/core/src/xmake/package/loadxmi.c +++ b/core/src/xmake/package/loadxmi.c @@ -43,7 +43,6 @@ typedef int (*xm_setup_func_t)(xmi_lua_ops_t *ops); * implementation */ tb_int_t xm_package_loadxmi(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); tb_char_t const *path = luaL_checkstring(lua, 1); diff --git a/core/src/xmake/path/absolute.c b/core/src/xmake/path/absolute.c index 781d2f5e4..9b05bc07d 100644 --- a/core/src/xmake/path/absolute.c +++ b/core/src/xmake/path/absolute.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_path_absolute(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path diff --git a/core/src/xmake/path/directory.c b/core/src/xmake/path/directory.c index aca226a89..0c7d77f2d 100644 --- a/core/src/xmake/path/directory.c +++ b/core/src/xmake/path/directory.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_path_directory(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path diff --git a/core/src/xmake/path/is_absolute.c b/core/src/xmake/path/is_absolute.c index 120476242..7ac489e26 100644 --- a/core/src/xmake/path/is_absolute.c +++ b/core/src/xmake/path/is_absolute.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_path_is_absolute(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path diff --git a/core/src/xmake/path/relative.c b/core/src/xmake/path/relative.c index c6ddad14d..5d3beaaa5 100644 --- a/core/src/xmake/path/relative.c +++ b/core/src/xmake/path/relative.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_path_relative(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path diff --git a/core/src/xmake/path/translate.c b/core/src/xmake/path/translate.c index 422cd0320..7611d188a 100644 --- a/core/src/xmake/path/translate.c +++ b/core/src/xmake/path/translate.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_path_translate(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the path diff --git a/core/src/xmake/process/close.c b/core/src/xmake/process/close.c index 272a02259..fc57453e6 100644 --- a/core/src/xmake/process/close.c +++ b/core/src/xmake/process/close.c @@ -36,7 +36,6 @@ // process.close(p) tb_int_t xm_process_close(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/process/kill.c b/core/src/xmake/process/kill.c index 7eb4f8fd7..4859027b4 100644 --- a/core/src/xmake/process/kill.c +++ b/core/src/xmake/process/kill.c @@ -36,7 +36,6 @@ // process.kill(p) tb_int_t xm_process_kill(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/process/open.c b/core/src/xmake/process/open.c index 8ed62a0cd..f0885719a 100644 --- a/core/src/xmake/process/open.c +++ b/core/src/xmake/process/open.c @@ -42,7 +42,6 @@ * envs = {"PATH=xxx", "XXX=yyy"}}) */ tb_int_t xm_process_open(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get command diff --git a/core/src/xmake/process/openv.c b/core/src/xmake/process/openv.c index e605822b1..99a6133d0 100644 --- a/core/src/xmake/process/openv.c +++ b/core/src/xmake/process/openv.c @@ -46,7 +46,6 @@ * envs = {"PATH=xxx", "XXX=yyy"}}) */ tb_int_t xm_process_openv(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // check argv @@ -323,6 +322,5 @@ tb_int_t xm_process_openv(lua_State *lua) { tb_free(argv); argv = tb_null; - // ok return 1; } diff --git a/core/src/xmake/process/wait.c b/core/src/xmake/process/wait.c index 2914d87cc..84d3b7079 100644 --- a/core/src/xmake/process/wait.c +++ b/core/src/xmake/process/wait.c @@ -36,7 +36,6 @@ // ok, status = process.wait(proc, timeout) tb_int_t xm_process_wait(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? @@ -62,6 +61,5 @@ tb_int_t xm_process_wait(lua_State *lua) { lua_pushinteger(lua, ok); lua_pushinteger(lua, status); - // ok return 2; } diff --git a/core/src/xmake/readline/add_history.c b/core/src/xmake/readline/add_history.c index f928cc446..8f0c1cf4d 100644 --- a/core/src/xmake/readline/add_history.c +++ b/core/src/xmake/readline/add_history.c @@ -37,7 +37,6 @@ // add_history wrapper tb_int_t xm_readline_add_history(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get history @@ -47,7 +46,6 @@ tb_int_t xm_readline_add_history(lua_State *lua) { // call add_history add_history(history); - // ok return 0; } #endif diff --git a/core/src/xmake/readline/clear_history.c b/core/src/xmake/readline/clear_history.c index 11f7ab30c..0235ea4ee 100644 --- a/core/src/xmake/readline/clear_history.c +++ b/core/src/xmake/readline/clear_history.c @@ -37,7 +37,6 @@ // clear_history wrapper tb_int_t xm_readline_clear_history(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); #ifdef TB_CONFIG_OS_MACOSX @@ -48,7 +47,6 @@ tb_int_t xm_readline_clear_history(lua_State *lua) { clear_history(); #endif - // ok return 0; } diff --git a/core/src/xmake/readline/history_list.c b/core/src/xmake/readline/history_list.c index 56d84e114..45267edd5 100644 --- a/core/src/xmake/readline/history_list.c +++ b/core/src/xmake/readline/history_list.c @@ -37,7 +37,6 @@ // history_list wrapper tb_int_t xm_readline_history_list(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // history list @@ -70,7 +69,6 @@ tb_int_t xm_readline_history_list(lua_State *lua) { } #endif - // ok return 1; } diff --git a/core/src/xmake/readline/readline.c b/core/src/xmake/readline/readline.c index 6675c6de2..b6988e35c 100644 --- a/core/src/xmake/readline/readline.c +++ b/core/src/xmake/readline/readline.c @@ -38,7 +38,6 @@ // readline wrapper tb_int_t xm_readline_readline(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the prompt @@ -55,7 +54,6 @@ tb_int_t xm_readline_readline(lua_State *lua) { } else lua_pushnil(lua); - // ok return 1; } diff --git a/core/src/xmake/sandbox/interactive.c b/core/src/xmake/sandbox/interactive.c index 01bac19b4..9e94f876d 100644 --- a/core/src/xmake/sandbox/interactive.c +++ b/core/src/xmake/sandbox/interactive.c @@ -121,7 +121,6 @@ static tb_int_t xm_sandbox_docall(lua_State *lua, tb_int_t narg, tb_int_t clear) if (status != 0) lua_gc(lua, LUA_GCCOLLECT, 0); - // ok? return status; } @@ -158,7 +157,6 @@ static tb_size_t xm_sandbox_readline(tb_char_t *data, tb_size_t maxn, tb_char_t if (size >= maxn) return 0; - // ok return size; } #else @@ -189,7 +187,6 @@ static tb_int_t xm_sandbox_pushline(lua_State *lua, tb_char_t const *prompt2) { // push line lua_pushstring(lua, data); - // ok return 1; } @@ -228,7 +225,6 @@ static tb_int_t xm_sandbox_loadline(lua_State *lua, tb_int_t top) { // attempt to load "return ..." status = luaL_loadbuffer(lua, data, size + 7, "=stdin"); - // ok? if (status != LUA_ERRSYNTAX) return status; @@ -292,7 +288,6 @@ static tb_int_t xm_sandbox_loadline(lua_State *lua, tb_int_t top) { // sandbox.interactive() tb_int_t xm_sandbox_interactive(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); /* get init stack top @@ -358,6 +353,5 @@ tb_int_t xm_sandbox_interactive(lua_State *lua) { tb_printl(""); tb_print_sync(); - // end return 0; } diff --git a/core/src/xmake/semver/compare.c b/core/src/xmake/semver/compare.c index 87e2356a3..8310b73fc 100644 --- a/core/src/xmake/semver/compare.c +++ b/core/src/xmake/semver/compare.c @@ -36,7 +36,6 @@ // semver.compare("v1.0.1-beta", "1.2") > 0? tb_int_t xm_semver_compare(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the version1 string @@ -66,7 +65,6 @@ tb_int_t xm_semver_compare(lua_State *lua) { // do compare lua_pushinteger(lua, semver_pcmp(&semver1, &semver2)); - // end semver_dtor(&semver1); semver_dtor(&semver2); return 1; diff --git a/core/src/xmake/semver/parse.c b/core/src/xmake/semver/parse.c index e9dc221ee..63bd47f93 100644 --- a/core/src/xmake/semver/parse.c +++ b/core/src/xmake/semver/parse.c @@ -55,7 +55,6 @@ * */ tb_int_t xm_semver_parse(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the version string @@ -70,7 +69,6 @@ tb_int_t xm_semver_parse(lua_State *lua) { return 2; } - // ok lua_pushsemver(lua, &semver); semver_dtor(&semver); return 1; diff --git a/core/src/xmake/semver/satisfies.c b/core/src/xmake/semver/satisfies.c index 55c0decb9..a7c47f4fa 100644 --- a/core/src/xmake/semver/satisfies.c +++ b/core/src/xmake/semver/satisfies.c @@ -39,7 +39,6 @@ * semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') => true */ tb_int_t xm_semver_satisfies(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the version string diff --git a/core/src/xmake/semver/select.c b/core/src/xmake/semver/select.c index 373a71711..7109bfc83 100644 --- a/core/src/xmake/semver/select.c +++ b/core/src/xmake/semver/select.c @@ -75,7 +75,6 @@ static tb_bool_t xm_semver_select_from_versions_tags1( // exit the popped semver semver_dtor(&top); - // ok return tb_true; } static tb_bool_t xm_semver_select_from_versions_tags2( @@ -173,7 +172,6 @@ static tb_bool_t xm_semver_select_latest_from_versions_tags(lua_State *lua, * local versioninfo, errors = semver.select(">=1.5.0 <1.6", {"1.5.0", "1.5.1"}, {"v1.5.0", ..}, {"latest", "dev"}) */ tb_int_t xm_semver_select(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // select version @@ -260,6 +258,5 @@ tb_int_t xm_semver_select(lua_State *lua) { return 2; } - // ok return 1; } diff --git a/core/src/xmake/semver/semver.c b/core/src/xmake/semver/semver.c index 4fe48e5e9..bd13828fa 100644 --- a/core/src/xmake/semver/semver.c +++ b/core/src/xmake/semver/semver.c @@ -34,7 +34,6 @@ * implementation */ tb_void_t lua_pushsemver(lua_State *lua, semver_t const *semver) { - // check tb_assert(lua && semver); // return a semver table diff --git a/core/src/xmake/string/convert.c b/core/src/xmake/string/convert.c index 65750d95e..88dc5ceb1 100644 --- a/core/src/xmake/string/convert.c +++ b/core/src/xmake/string/convert.c @@ -98,7 +98,6 @@ static xm_charset_entry_ref_t xm_string_charset_find_by_name(tb_char_t const *na * @endcode */ tb_int_t xm_string_convert(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the string and charset types @@ -137,6 +136,5 @@ tb_int_t xm_string_convert(lua_State *lua) { tb_free(dst_data); } - // ok return 1; } diff --git a/core/src/xmake/string/endswith.c b/core/src/xmake/string/endswith.c index 5905610f6..f7e5e1805 100644 --- a/core/src/xmake/string/endswith.c +++ b/core/src/xmake/string/endswith.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_string_endswith(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the string and suffix @@ -47,6 +46,5 @@ tb_int_t xm_string_endswith(lua_State *lua) { // string:endswith(suffix)? lua_pushboolean(lua, string_size >= suffix_size && !tb_strcmp(string + string_size - suffix_size, suffix)); - // ok return 1; } diff --git a/core/src/xmake/string/lastof.c b/core/src/xmake/string/lastof.c index c9df2213d..0d52e01ac 100644 --- a/core/src/xmake/string/lastof.c +++ b/core/src/xmake/string/lastof.c @@ -71,7 +71,6 @@ static tb_void_t xm_string_lastof_chr(lua_State *lua, tb_char_t const *cstr, tb_ * @param substr the substring */ tb_int_t xm_string_lastof(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get string diff --git a/core/src/xmake/string/split.c b/core/src/xmake/string/split.c index be2904f99..56e8a636d 100644 --- a/core/src/xmake/string/split.c +++ b/core/src/xmake/string/split.c @@ -101,7 +101,6 @@ static tb_void_t xm_string_split_chr( * @param limit the limit count */ tb_int_t xm_string_split(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get string diff --git a/core/src/xmake/string/startswith.c b/core/src/xmake/string/startswith.c index c7fe9dcca..04b53ffa7 100644 --- a/core/src/xmake/string/startswith.c +++ b/core/src/xmake/string/startswith.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_string_startswith(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the string and prefix @@ -46,6 +45,5 @@ tb_int_t xm_string_startswith(lua_State *lua) { // string:startswith(prefix)? lua_pushboolean(lua, !tb_strncmp(string, prefix, (tb_size_t)prefix_size)); - // ok return 1; } diff --git a/core/src/xmake/string/trim.c b/core/src/xmake/string/trim.c index d22f86666..c1dcdad8d 100644 --- a/core/src/xmake/string/trim.c +++ b/core/src/xmake/string/trim.c @@ -34,7 +34,6 @@ * private implementation */ static tb_void_t xm_string_trim_space(tb_char_t const **psstr, tb_char_t const **pestr, tb_int_t mode) { - // check tb_assert(psstr && pestr && *psstr && *pestr); tb_char_t const *p = *psstr; @@ -62,7 +61,6 @@ static tb_char_t const *xm_string_ltrim(tb_char_t const *sstr, tb_char_t const *estr, tb_char_t const *ctrim, size_t ntrim) { - // check tb_assert(sstr && estr && ctrim); tb_char_t const *p = sstr; @@ -75,7 +73,6 @@ static tb_char_t const *xm_string_rtrim(tb_char_t const *sstr, tb_char_t const *estr, tb_char_t const *ctrim, size_t ntrim) { - // check tb_assert(sstr && estr && ctrim); tb_char_t const *p = estr - 1; @@ -100,7 +97,6 @@ static tb_char_t const *xm_string_rtrim(tb_char_t const *sstr, * @endcode */ tb_int_t xm_string_trim(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); size_t lstr, ltrim; @@ -127,7 +123,6 @@ tb_int_t xm_string_trim(lua_State *lua) { // no trimed chars tb_check_break(sstr != rsstr || estr != restr); - // ok lua_pushlstring(lua, sstr, estr - sstr); return 1; diff --git a/core/src/xmake/thread/thread_exit.c b/core/src/xmake/thread/thread_exit.c index a91018ac6..ae828805e 100644 --- a/core/src/xmake/thread/thread_exit.c +++ b/core/src/xmake/thread/thread_exit.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_thread_exit(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/thread/thread_init.c b/core/src/xmake/thread/thread_init.c index 60d694ae1..2a792463a 100644 --- a/core/src/xmake/thread/thread_init.c +++ b/core/src/xmake/thread/thread_init.c @@ -81,7 +81,6 @@ static tb_int_t xm_thread_func(tb_cpointer_t priv) { * implementation */ tb_int_t xm_thread_init(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); tb_bool_t ok = tb_false; diff --git a/core/src/xmake/thread/thread_resume.c b/core/src/xmake/thread/thread_resume.c index 9a3630338..45253b418 100644 --- a/core/src/xmake/thread/thread_resume.c +++ b/core/src/xmake/thread/thread_resume.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_thread_resume(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/thread/thread_suspend.c b/core/src/xmake/thread/thread_suspend.c index dcb24c4f6..1df3063ef 100644 --- a/core/src/xmake/thread/thread_suspend.c +++ b/core/src/xmake/thread/thread_suspend.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_thread_suspend(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/thread/thread_wait.c b/core/src/xmake/thread/thread_wait.c index 4a921f39c..8ceb45524 100644 --- a/core/src/xmake/thread/thread_wait.c +++ b/core/src/xmake/thread/thread_wait.c @@ -34,7 +34,6 @@ * implementation */ tb_int_t xm_thread_wait(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // is pointer? diff --git a/core/src/xmake/tty/term_mode.c b/core/src/xmake/tty/term_mode.c index 78380de5f..34998c60b 100644 --- a/core/src/xmake/tty/term_mode.c +++ b/core/src/xmake/tty/term_mode.c @@ -41,7 +41,6 @@ * local oldmode = tty.term_mode(stdtype, newmode) */ tb_int_t xm_tty_term_mode(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); #ifdef TB_CONFIG_OS_WINDOWS diff --git a/core/src/xmake/utils/bin2c.c b/core/src/xmake/utils/bin2c.c index fef00fb4e..77a1b2a8c 100644 --- a/core/src/xmake/utils/bin2c.c +++ b/core/src/xmake/utils/bin2c.c @@ -101,7 +101,6 @@ static tb_bool_t xm_utils_bin2c_dump(tb_stream_ref_t istream, * local ok, errors = utils.bin2c(binaryfile, outputfile, linewidth, nozeroend) */ tb_int_t xm_utils_bin2c(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the binaryfile diff --git a/core/src/xmake/winos/ansi.c b/core/src/xmake/winos/ansi.c index 137f18742..48bb9df82 100644 --- a/core/src/xmake/winos/ansi.c +++ b/core/src/xmake/winos/ansi.c @@ -36,7 +36,6 @@ */ static tb_int_t xm_expand_cp(tb_int_t cp) { - // check tb_assert_and_check_return_val(cp >= 0 && cp <= 65535, 0); if (cp == CP_OEMCP) @@ -47,7 +46,6 @@ static tb_int_t xm_expand_cp(tb_int_t cp) { } tb_int_t xm_winos_console_cp(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); tb_int_t n = lua_gettop(lua); @@ -66,7 +64,6 @@ tb_int_t xm_winos_console_cp(lua_State *lua) { } tb_int_t xm_winos_console_output_cp(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); tb_int_t n = lua_gettop(lua); @@ -85,7 +82,6 @@ tb_int_t xm_winos_console_output_cp(lua_State *lua) { } tb_int_t xm_winos_cp_info(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); lua_Integer cp = luaL_checkinteger(lua, 1); @@ -138,7 +134,6 @@ tb_int_t xm_winos_cp_info(lua_State *lua) { } tb_int_t xm_winos_ansi_cp(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); tb_uint_t cp = GetACP(); @@ -147,7 +142,6 @@ tb_int_t xm_winos_ansi_cp(lua_State *lua) { } tb_int_t xm_winos_oem_cp(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); tb_uint_t cp = GetOEMCP(); diff --git a/core/src/xmake/winos/logical_drives.c b/core/src/xmake/winos/logical_drives.c index 48b05886e..7227069b9 100644 --- a/core/src/xmake/winos/logical_drives.c +++ b/core/src/xmake/winos/logical_drives.c @@ -73,6 +73,5 @@ tb_int_t xm_winos_logical_drives(lua_State *lua) { tb_free(data); data = tb_null; - // ok return 1; } diff --git a/core/src/xmake/winos/registry_keys.c b/core/src/xmake/winos/registry_keys.c index 42a37e33d..7daf44ff4 100644 --- a/core/src/xmake/winos/registry_keys.c +++ b/core/src/xmake/winos/registry_keys.c @@ -168,7 +168,6 @@ static tb_void_t xm_winos_registry_enum_keys(xm_winos_registry_enum_info_t *info * end) */ tb_int_t xm_winos_registry_keys(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the arguments @@ -231,7 +230,6 @@ tb_int_t xm_winos_registry_keys(lua_State *lua) { } while (0); - // ok? if (ok) { lua_pushinteger(lua, count); return 1; diff --git a/core/src/xmake/winos/registry_query.c b/core/src/xmake/winos/registry_query.c index 23fda76ff..5e98af2cd 100644 --- a/core/src/xmake/winos/registry_query.c +++ b/core/src/xmake/winos/registry_query.c @@ -46,7 +46,6 @@ typedef BOOL(WINAPI *xm_RegGetValueW_t)( * local value, errors = winos.registry_query("HKEY_LOCAL_MACHINE", "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", "Debugger") */ tb_int_t xm_winos_registry_query(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the arguments @@ -226,6 +225,5 @@ tb_int_t xm_winos_registry_query(lua_State *lua) { tb_free(value_w); value_w = tb_null; - // ok? return ok ? 1 : 2; } diff --git a/core/src/xmake/winos/registry_values.c b/core/src/xmake/winos/registry_values.c index 1f72d978b..6bda8e690 100644 --- a/core/src/xmake/winos/registry_values.c +++ b/core/src/xmake/winos/registry_values.c @@ -43,7 +43,6 @@ * end) */ tb_int_t xm_winos_registry_values(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the arguments @@ -156,7 +155,6 @@ tb_int_t xm_winos_registry_values(lua_State *lua) { } } - // ok if (i == value_name_num) ok = tb_true; @@ -167,7 +165,6 @@ tb_int_t xm_winos_registry_values(lua_State *lua) { RegCloseKey(keynew); keynew = tb_null; - // ok? if (ok) { lua_pushinteger(lua, count); return 1; diff --git a/core/src/xmake/winos/short_path.c b/core/src/xmake/winos/short_path.c index 5c6e20b30..9c2192787 100644 --- a/core/src/xmake/winos/short_path.c +++ b/core/src/xmake/winos/short_path.c @@ -39,7 +39,6 @@ * local short_path, errors = winos.short_path(long_path) */ tb_int_t xm_winos_short_path(lua_State *lua) { - // check tb_assert_and_check_return_val(lua, 0); // get the arguments diff --git a/core/src/xmake/xmake.c b/core/src/xmake/xmake.c index 89b288c79..8d4a77284 100644 --- a/core/src/xmake/xmake.c +++ b/core/src/xmake/xmake.c @@ -52,7 +52,6 @@ static __tb_inline__ tb_bool_t xm_check_mode(tb_size_t mode) { } #endif - // ok return tb_true; } static __tb_inline__ tb_bool_t xm_version_check(tb_hize_t build) { @@ -60,7 +59,6 @@ static __tb_inline__ tb_bool_t xm_version_check(tb_hize_t build) { tb_version_t const *version = xm_version(); tb_used(version); - // ok if ((build / 100) == (XM_VERSION_BUILD / 100)) { tb_trace_d("version: %s", XM_VERSION_STRING); return tb_true; @@ -76,7 +74,6 @@ static __tb_inline__ tb_bool_t xm_version_check(tb_hize_t build) { * implementation */ tb_bool_t xm_init_(tb_size_t mode, tb_hize_t build) { - // trace tb_trace_d("init: .."); // check mode @@ -95,10 +92,8 @@ tb_bool_t xm_init_(tb_size_t mode, tb_hize_t build) { return tb_false; #endif - // trace tb_trace_d("init: ok"); - // ok return tb_true; } tb_void_t xm_exit() { -- cgit v1.3.1 From 12e00a411dfe202dcfa1de9a8511a802ce1af40d Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 9 Nov 2025 20:16:46 +0800 Subject: format single line --- core/src/xmake/base64/encode.c | 6 ++++-- core/src/xmake/bloom_filter/bloom_filter_clear.c | 3 ++- core/src/xmake/bloom_filter/bloom_filter_close.c | 3 ++- core/src/xmake/bloom_filter/bloom_filter_data.c | 9 ++++++--- core/src/xmake/bloom_filter/bloom_filter_data_set.c | 9 ++++++--- core/src/xmake/bloom_filter/bloom_filter_get.c | 3 ++- core/src/xmake/bloom_filter/bloom_filter_open.c | 6 ++++-- core/src/xmake/bloom_filter/bloom_filter_set.c | 3 ++- core/src/xmake/bloom_filter/bloom_filter_size.c | 3 ++- core/src/xmake/thread/sharedata_get.c | 6 ++++-- core/src/xmake/thread/sharedata_set.c | 6 ++++-- core/src/xmake/thread/thread_exit.c | 3 ++- core/src/xmake/thread/thread_init.c | 6 ++++-- 13 files changed, 44 insertions(+), 22 deletions(-) (limited to 'core/src/xmake/thread/thread_exit.c') diff --git a/core/src/xmake/base64/encode.c b/core/src/xmake/base64/encode.c index d896cb55e..d5ce56306 100644 --- a/core/src/xmake/base64/encode.c +++ b/core/src/xmake/base64/encode.c @@ -39,10 +39,12 @@ tb_int_t xm_base64_encode(lua_State *lua) { // get data and size tb_size_t size = 0; tb_byte_t const *data = tb_null; - if (xm_lua_isinteger(lua, 1)) + if (xm_lua_isinteger(lua, 1)) { data = (tb_byte_t const *)(tb_size_t)(tb_long_t)lua_tointeger(lua, 1); - if (xm_lua_isinteger(lua, 2)) + } + if (xm_lua_isinteger(lua, 2)) { size = (tb_size_t)lua_tointeger(lua, 2); + } if (!data || !size) { lua_pushnil(lua); lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size); diff --git a/core/src/xmake/bloom_filter/bloom_filter_clear.c b/core/src/xmake/bloom_filter/bloom_filter_clear.c index 2657cc5dc..7693baa48 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_clear.c +++ b/core/src/xmake/bloom_filter/bloom_filter_clear.c @@ -37,8 +37,9 @@ tb_int_t xm_bloom_filter_clear(lua_State *lua) { tb_assert_and_check_return_val(lua, 0); // is pointer? - if (!xm_lua_ispointer(lua, 1)) + if (!xm_lua_ispointer(lua, 1)) { return 0; + } // get the bloom filter tb_bloom_filter_ref_t filter = (tb_bloom_filter_ref_t)xm_lua_topointer(lua, 1); diff --git a/core/src/xmake/bloom_filter/bloom_filter_close.c b/core/src/xmake/bloom_filter/bloom_filter_close.c index 59d3e59a1..ba47860a5 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_close.c +++ b/core/src/xmake/bloom_filter/bloom_filter_close.c @@ -37,8 +37,9 @@ tb_int_t xm_bloom_filter_close(lua_State *lua) { tb_assert_and_check_return_val(lua, 0); // is pointer? - if (!xm_lua_ispointer(lua, 1)) + if (!xm_lua_ispointer(lua, 1)) { return 0; + } // get the bloom filter tb_bloom_filter_ref_t filter = (tb_bloom_filter_ref_t)xm_lua_topointer(lua, 1); diff --git a/core/src/xmake/bloom_filter/bloom_filter_data.c b/core/src/xmake/bloom_filter/bloom_filter_data.c index 9d6f34e64..d60b97d11 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_data.c +++ b/core/src/xmake/bloom_filter/bloom_filter_data.c @@ -37,8 +37,9 @@ tb_int_t xm_bloom_filter_data(lua_State *lua) { tb_assert_and_check_return_val(lua, 0); // is pointer? - if (!xm_lua_ispointer(lua, 1)) + if (!xm_lua_ispointer(lua, 1)) { return 0; + } // get the bloom filter tb_bloom_filter_ref_t filter = (tb_bloom_filter_ref_t)xm_lua_topointer(lua, 1); @@ -46,9 +47,11 @@ tb_int_t xm_bloom_filter_data(lua_State *lua) { // get data tb_pointer_t data = (tb_pointer_t)tb_bloom_filter_data(filter); - if (data) + if (data) { xm_lua_pushpointer(lua, data); - else + } + else { lua_pushnil(lua); + } return 1; } diff --git a/core/src/xmake/bloom_filter/bloom_filter_data_set.c b/core/src/xmake/bloom_filter/bloom_filter_data_set.c index 984ec6562..6d2d48606 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_data_set.c +++ b/core/src/xmake/bloom_filter/bloom_filter_data_set.c @@ -37,8 +37,9 @@ tb_int_t xm_bloom_filter_data_set(lua_State *lua) { tb_assert_and_check_return_val(lua, 0); // is pointer? - if (!xm_lua_ispointer(lua, 1)) + if (!xm_lua_ispointer(lua, 1)) { return 0; + } // get the bloom filter tb_bloom_filter_ref_t filter = (tb_bloom_filter_ref_t)xm_lua_topointer(lua, 1); @@ -47,10 +48,12 @@ tb_int_t xm_bloom_filter_data_set(lua_State *lua) { // get data and size tb_size_t size = 0; tb_byte_t const *data = tb_null; - if (xm_lua_isinteger(lua, 2)) + if (xm_lua_isinteger(lua, 2)) { data = (tb_byte_t const *)(tb_size_t)(tb_long_t)lua_tointeger(lua, 2); - if (xm_lua_isinteger(lua, 3)) + } + if (xm_lua_isinteger(lua, 3)) { size = (tb_size_t)lua_tointeger(lua, 3); + } if (!data || !size) { lua_pushinteger(lua, -1); lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size); diff --git a/core/src/xmake/bloom_filter/bloom_filter_get.c b/core/src/xmake/bloom_filter/bloom_filter_get.c index dd1f8d1e6..ffd1f82c7 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_get.c +++ b/core/src/xmake/bloom_filter/bloom_filter_get.c @@ -37,8 +37,9 @@ tb_int_t xm_bloom_filter_get(lua_State *lua) { tb_assert_and_check_return_val(lua, 0); // is pointer? - if (!xm_lua_ispointer(lua, 1)) + if (!xm_lua_ispointer(lua, 1)) { return 0; + } // get the bloom filter tb_bloom_filter_ref_t filter = (tb_bloom_filter_ref_t)xm_lua_topointer(lua, 1); diff --git a/core/src/xmake/bloom_filter/bloom_filter_open.c b/core/src/xmake/bloom_filter/bloom_filter_open.c index be364be91..a97ab6d81 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_open.c +++ b/core/src/xmake/bloom_filter/bloom_filter_open.c @@ -48,9 +48,11 @@ tb_int_t xm_bloom_filter_open(lua_State *lua) { // init the bloom filter tb_bloom_filter_ref_t filter = tb_bloom_filter_init(probability, hash_count, item_maxn, tb_element_str(tb_true)); - if (filter) + if (filter) { xm_lua_pushpointer(lua, (tb_pointer_t)filter); - else + } + else { lua_pushnil(lua); + } return 1; } diff --git a/core/src/xmake/bloom_filter/bloom_filter_set.c b/core/src/xmake/bloom_filter/bloom_filter_set.c index 51d85d0a7..6762ea5bc 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_set.c +++ b/core/src/xmake/bloom_filter/bloom_filter_set.c @@ -37,8 +37,9 @@ tb_int_t xm_bloom_filter_set(lua_State *lua) { tb_assert_and_check_return_val(lua, 0); // is pointer? - if (!xm_lua_ispointer(lua, 1)) + if (!xm_lua_ispointer(lua, 1)) { return 0; + } // get the bloom filter tb_bloom_filter_ref_t filter = (tb_bloom_filter_ref_t)xm_lua_topointer(lua, 1); diff --git a/core/src/xmake/bloom_filter/bloom_filter_size.c b/core/src/xmake/bloom_filter/bloom_filter_size.c index 977b455f3..730968a12 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_size.c +++ b/core/src/xmake/bloom_filter/bloom_filter_size.c @@ -37,8 +37,9 @@ tb_int_t xm_bloom_filter_size(lua_State *lua) { tb_assert_and_check_return_val(lua, 0); // is pointer? - if (!xm_lua_ispointer(lua, 1)) + if (!xm_lua_ispointer(lua, 1)) { return 0; + } // get the bloom filter tb_bloom_filter_ref_t filter = (tb_bloom_filter_ref_t)xm_lua_topointer(lua, 1); diff --git a/core/src/xmake/thread/sharedata_get.c b/core/src/xmake/thread/sharedata_get.c index a239fb02d..cffc5860c 100644 --- a/core/src/xmake/thread/sharedata_get.c +++ b/core/src/xmake/thread/sharedata_get.c @@ -42,12 +42,14 @@ tb_int_t xm_thread_sharedata_get_(lua_State *lua) { tb_bool_t ok = tb_false; switch (thread_sharedata->value.kind) { case XM_THREAD_VALUE_STR: - if (tb_buffer_size(&thread_sharedata->buffer) > 0) + if (tb_buffer_size(&thread_sharedata->buffer) > 0) { lua_pushlstring(lua, (tb_char_t *)tb_buffer_data(&thread_sharedata->buffer), tb_buffer_size(&thread_sharedata->buffer)); - else + } + else { lua_pushliteral(lua, ""); + } ok = tb_true; break; case XM_THREAD_VALUE_INT: diff --git a/core/src/xmake/thread/sharedata_set.c b/core/src/xmake/thread/sharedata_set.c index 9f1e6b613..33f8a8561 100644 --- a/core/src/xmake/thread/sharedata_set.c +++ b/core/src/xmake/thread/sharedata_set.c @@ -45,10 +45,12 @@ tb_int_t xm_thread_sharedata_set(lua_State *lua) { tb_assert_and_check_return_val(data, 0); thread_sharedata->value.kind = (tb_uint32_t)XM_THREAD_VALUE_STR; - if (data_size) + if (data_size) { tb_buffer_memncpy(&thread_sharedata->buffer, (tb_byte_t const *)data, data_size); - else + } + else { tb_buffer_clear(&thread_sharedata->buffer); + } } else if (xm_lua_isinteger(lua, 2)) { thread_sharedata->value.kind = (tb_uint32_t)XM_THREAD_VALUE_INT; thread_sharedata->value.u.integer = lua_tointeger(lua, 2); diff --git a/core/src/xmake/thread/thread_exit.c b/core/src/xmake/thread/thread_exit.c index ae828805e..ca495d4a5 100644 --- a/core/src/xmake/thread/thread_exit.c +++ b/core/src/xmake/thread/thread_exit.c @@ -37,8 +37,9 @@ tb_int_t xm_thread_exit(lua_State *lua) { tb_assert_and_check_return_val(lua, 0); // is pointer? - if (!xm_lua_ispointer(lua, 1)) + if (!xm_lua_ispointer(lua, 1)) { return 0; + } // get thread xm_thread_t *thread = (xm_thread_t *)xm_lua_topointer(lua, 1); diff --git a/core/src/xmake/thread/thread_init.c b/core/src/xmake/thread/thread_init.c index 2a792463a..2d3e067f7 100644 --- a/core/src/xmake/thread/thread_init.c +++ b/core/src/xmake/thread/thread_init.c @@ -46,8 +46,9 @@ static tb_int_t xm_thread_func(tb_cpointer_t priv) { tb_assert_and_check_return_val(thread, 0); xm_engine_ref_t engine = xm_engine_pool_alloc(xm_engine_pool()); - if (!engine) + if (!engine) { engine = xm_engine_init(XM_THREAD_ENGINE_NAME, tb_null); + } if (engine) { lua_State *lua = xm_engine_lua(engine); tb_assert(lua); @@ -71,8 +72,9 @@ static tb_int_t xm_thread_func(tb_cpointer_t priv) { // start engine tb_char_t *argv[] = { XM_THREAD_ENGINE_NAME, tb_null }; xm_engine_main(engine, 1, argv, tb_null); - if (!xm_engine_pool_free(xm_engine_pool(), engine)) + if (!xm_engine_pool_free(xm_engine_pool(), engine)) { xm_engine_exit(engine); + } } return 0; } -- cgit v1.3.1