summaryrefslogtreecommitdiff
path: root/core/src/xmake/path
diff options
context:
space:
mode:
authorruki <[email protected]>2025-11-09 19:11:32 +0800
committerruki <[email protected]>2025-11-09 19:44:18 +0800
commitc89c94bf89e98c8e42e786aacc0b334a57474179 (patch)
tree60b4964d58a5289e1444b2375ec5db1a93eccdd6 /core/src/xmake/path
parent3f9c6f27ee8f99d5c4393433e8863fec93da43e7 (diff)
format code
Diffstat (limited to 'core/src/xmake/path')
-rw-r--r--core/src/xmake/path/absolute.c11
-rw-r--r--core/src/xmake/path/directory.c19
-rw-r--r--core/src/xmake/path/is_absolute.c9
-rw-r--r--core/src/xmake/path/prefix.h3
-rw-r--r--core/src/xmake/path/relative.c11
-rw-r--r--core/src/xmake/path/translate.c18
6 files changed, 33 insertions, 38 deletions
diff --git a/core/src/xmake/path/absolute.c b/core/src/xmake/path/absolute.c
index a780cdce8..781d2f5e4 100644
--- a/core/src/xmake/path/absolute.c
+++ b/core/src/xmake/path/absolute.c
@@ -22,8 +22,8 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* trace
*/
-#define TB_TRACE_MODULE_NAME "absolute"
-#define TB_TRACE_MODULE_DEBUG (0)
+#define TB_TRACE_MODULE_NAME "absolute"
+#define TB_TRACE_MODULE_DEBUG (0)
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
@@ -33,17 +33,16 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* implementation
*/
-tb_int_t xm_path_absolute(lua_State* lua)
-{
+tb_int_t xm_path_absolute(lua_State *lua) {
// check
tb_assert_and_check_return_val(lua, 0);
// get the path
- tb_char_t const* path = luaL_checkstring(lua, 1);
+ tb_char_t const *path = luaL_checkstring(lua, 1);
tb_check_return_val(path, 0);
// get the root
- tb_char_t const* root = luaL_optstring(lua, 2, tb_null);
+ tb_char_t const *root = luaL_optstring(lua, 2, tb_null);
// do path:absolute(root)
tb_char_t data[TB_PATH_MAXN];
diff --git a/core/src/xmake/path/directory.c b/core/src/xmake/path/directory.c
index 2af805d45..aca226a89 100644
--- a/core/src/xmake/path/directory.c
+++ b/core/src/xmake/path/directory.c
@@ -22,8 +22,8 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* trace
*/
-#define TB_TRACE_MODULE_NAME "directory"
-#define TB_TRACE_MODULE_DEBUG (0)
+#define TB_TRACE_MODULE_NAME "directory"
+#define TB_TRACE_MODULE_DEBUG (0)
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
@@ -33,19 +33,20 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* implementation
*/
-tb_int_t xm_path_directory(lua_State* lua)
-{
+tb_int_t xm_path_directory(lua_State *lua) {
// check
tb_assert_and_check_return_val(lua, 0);
// get the path
- tb_char_t const* path = luaL_checkstring(lua, 1);
+ tb_char_t const *path = luaL_checkstring(lua, 1);
tb_check_return_val(path, 0);
// do path:directory()
- tb_char_t data[TB_PATH_MAXN];
- tb_char_t const* dir = tb_path_directory(path, data, sizeof(data));
- if (dir) lua_pushstring(lua, dir);
- else lua_pushnil(lua);
+ tb_char_t data[TB_PATH_MAXN];
+ tb_char_t const *dir = tb_path_directory(path, data, sizeof(data));
+ if (dir)
+ lua_pushstring(lua, dir);
+ else
+ lua_pushnil(lua);
return 1;
}
diff --git a/core/src/xmake/path/is_absolute.c b/core/src/xmake/path/is_absolute.c
index 7ced8d3fe..120476242 100644
--- a/core/src/xmake/path/is_absolute.c
+++ b/core/src/xmake/path/is_absolute.c
@@ -22,8 +22,8 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* trace
*/
-#define TB_TRACE_MODULE_NAME "is_absolute"
-#define TB_TRACE_MODULE_DEBUG (0)
+#define TB_TRACE_MODULE_NAME "is_absolute"
+#define TB_TRACE_MODULE_DEBUG (0)
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
@@ -33,13 +33,12 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* implementation
*/
-tb_int_t xm_path_is_absolute(lua_State* lua)
-{
+tb_int_t xm_path_is_absolute(lua_State *lua) {
// check
tb_assert_and_check_return_val(lua, 0);
// get the path
- tb_char_t const* path = luaL_checkstring(lua, 1);
+ tb_char_t const *path = luaL_checkstring(lua, 1);
tb_check_return_val(path, 0);
// path:is_absolute()
diff --git a/core/src/xmake/path/prefix.h b/core/src/xmake/path/prefix.h
index 3fe86b204..c87dc37bf 100644
--- a/core/src/xmake/path/prefix.h
+++ b/core/src/xmake/path/prefix.h
@@ -26,7 +26,4 @@
*/
#include "../prefix.h"
-
#endif
-
-
diff --git a/core/src/xmake/path/relative.c b/core/src/xmake/path/relative.c
index ec1dcc215..c6ddad14d 100644
--- a/core/src/xmake/path/relative.c
+++ b/core/src/xmake/path/relative.c
@@ -22,8 +22,8 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* trace
*/
-#define TB_TRACE_MODULE_NAME "relative"
-#define TB_TRACE_MODULE_DEBUG (0)
+#define TB_TRACE_MODULE_NAME "relative"
+#define TB_TRACE_MODULE_DEBUG (0)
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
@@ -33,17 +33,16 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* implementation
*/
-tb_int_t xm_path_relative(lua_State* lua)
-{
+tb_int_t xm_path_relative(lua_State *lua) {
// check
tb_assert_and_check_return_val(lua, 0);
// get the path
- tb_char_t const* path = luaL_checkstring(lua, 1);
+ tb_char_t const *path = luaL_checkstring(lua, 1);
tb_check_return_val(path, 0);
// get the root
- tb_char_t const* root = luaL_optstring(lua, 2, tb_null);
+ tb_char_t const *root = luaL_optstring(lua, 2, tb_null);
// path:relative(root)
tb_char_t data[TB_PATH_MAXN];
diff --git a/core/src/xmake/path/translate.c b/core/src/xmake/path/translate.c
index ecb545098..422cd0320 100644
--- a/core/src/xmake/path/translate.c
+++ b/core/src/xmake/path/translate.c
@@ -22,8 +22,8 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* trace
*/
-#define TB_TRACE_MODULE_NAME "translate"
-#define TB_TRACE_MODULE_DEBUG (0)
+#define TB_TRACE_MODULE_NAME "translate"
+#define TB_TRACE_MODULE_DEBUG (0)
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
@@ -33,20 +33,18 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* implementation
*/
-tb_int_t xm_path_translate(lua_State* lua)
-{
+tb_int_t xm_path_translate(lua_State *lua) {
// check
tb_assert_and_check_return_val(lua, 0);
// get the path
size_t path_size = 0;
- tb_char_t const* path = luaL_checklstring(lua, 1, &path_size);
+ tb_char_t const *path = luaL_checklstring(lua, 1, &path_size);
tb_check_return_val(path, 0);
// get the option argument, e.g. {normalize = true}
tb_bool_t normalize = tb_false;
- if (lua_istable(lua, 2))
- {
+ if (lua_istable(lua, 2)) {
lua_pushstring(lua, "normalize");
lua_gettable(lua, 2);
if (lua_toboolean(lua, -1))
@@ -57,7 +55,9 @@ tb_int_t xm_path_translate(lua_State* lua)
// do path:translate()
tb_char_t data[TB_PATH_MAXN];
tb_size_t size = tb_path_translate_to(path, (tb_size_t)path_size, data, sizeof(data), normalize);
- if (size) lua_pushlstring(lua, data, (size_t)size);
- else lua_pushnil(lua);
+ if (size)
+ lua_pushlstring(lua, data, (size_t)size);
+ else
+ lua_pushnil(lua);
return 1;
}