summaryrefslogtreecommitdiff
path: root/core/src/xmake/string/endswith.c
diff options
context:
space:
mode:
authorruki <[email protected]>2017-06-16 15:45:31 +0800
committerruki <[email protected]>2017-06-16 15:45:31 +0800
commitb3cc1e1c42d8b367f2d0b1a93c236abe1cc94b34 (patch)
tree206f6249f3f61d856ecbfb731661a2514923a91f /core/src/xmake/string/endswith.c
parent4ce04f4a25ac9fa21e19ae4c568d7a253959680a (diff)
replace old find compiler scripts and fix string.endswith
Diffstat (limited to 'core/src/xmake/string/endswith.c')
-rw-r--r--core/src/xmake/string/endswith.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/src/xmake/string/endswith.c b/core/src/xmake/string/endswith.c
index 241e59254..8de61e2bb 100644
--- a/core/src/xmake/string/endswith.c
+++ b/core/src/xmake/string/endswith.c
@@ -49,9 +49,9 @@ tb_int_t xm_string_endswith(lua_State* lua)
tb_char_t const* suffix = luaL_checklstring(lua, 2, &suffix_size);
tb_check_return_val(string && suffix, 0);
- // done string:endswith(suffix)
- if (string_size >= suffix_size)
- lua_pushboolean(lua, !tb_strcmp(string + string_size - suffix_size, suffix));
+ // string:endswith(suffix)?
+ lua_pushboolean(lua, string_size >= suffix_size && !tb_strcmp(string + string_size - suffix_size, suffix));
+
// ok
return 1;