summaryrefslogtreecommitdiff
path: root/core/src/xmake/string/endswith.c
diff options
context:
space:
mode:
authorruki <[email protected]>2025-11-10 06:35:04 +0800
committerGitHub <[email protected]>2025-11-10 06:35:04 +0800
commit2b01e46fcf619aaecb8435b0fac975e3aff0587f (patch)
tree8f005a8dfc3272e9f027560e5e1b5881a7a8bc70 /core/src/xmake/string/endswith.c
parenta1b0ec856e2c22aac84022feb05b6687912e3d6e (diff)
parent2c387895657ae13cd717d7f42f5baed5eb028a8e (diff)
Merge pull request #7008 from xmake-io/format
format code
Diffstat (limited to 'core/src/xmake/string/endswith.c')
-rw-r--r--core/src/xmake/string/endswith.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/core/src/xmake/string/endswith.c b/core/src/xmake/string/endswith.c
index e6bb8b9c4..f7e5e1805 100644
--- a/core/src/xmake/string/endswith.c
+++ b/core/src/xmake/string/endswith.c
@@ -22,8 +22,8 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* trace
*/
-#define TB_TRACE_MODULE_NAME "endswith"
-#define TB_TRACE_MODULE_DEBUG (0)
+#define TB_TRACE_MODULE_NAME "endswith"
+#define TB_TRACE_MODULE_DEBUG (0)
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
@@ -33,21 +33,18 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* implementation
*/
-tb_int_t xm_string_endswith(lua_State* lua)
-{
- // check
+tb_int_t xm_string_endswith(lua_State *lua) {
tb_assert_and_check_return_val(lua, 0);
// get the string and suffix
- size_t string_size = 0;
- size_t suffix_size = 0;
- tb_char_t const* string = luaL_checklstring(lua, 1, &string_size);
- tb_char_t const* suffix = luaL_checklstring(lua, 2, &suffix_size);
+ size_t string_size = 0;
+ size_t suffix_size = 0;
+ tb_char_t const *string = luaL_checklstring(lua, 1, &string_size);
+ tb_char_t const *suffix = luaL_checklstring(lua, 2, &suffix_size);
tb_check_return_val(string && suffix, 0);
// string:endswith(suffix)?
lua_pushboolean(lua, string_size >= suffix_size && !tb_strcmp(string + string_size - suffix_size, suffix));
- // ok
return 1;
}