summaryrefslogtreecommitdiff
path: root/core/src/xmake/string/convert.c
diff options
context:
space:
mode:
authorruki <[email protected]>2025-11-10 21:00:21 +0800
committerruki <[email protected]>2025-11-10 21:00:21 +0800
commit2c387895657ae13cd717d7f42f5baed5eb028a8e (patch)
tree8f005a8dfc3272e9f027560e5e1b5881a7a8bc70 /core/src/xmake/string/convert.c
parent831447a51da0b094e08bb047247bf269a6e6cf71 (diff)
format more if-else codes in core
Diffstat (limited to 'core/src/xmake/string/convert.c')
-rw-r--r--core/src/xmake/string/convert.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/core/src/xmake/string/convert.c b/core/src/xmake/string/convert.c
index 88dc5ceb1..b3adaf8b8 100644
--- a/core/src/xmake/string/convert.c
+++ b/core/src/xmake/string/convert.c
@@ -76,10 +76,11 @@ static xm_charset_entry_ref_t xm_string_charset_find_by_name(tb_char_t const *na
// find it by the binary search
tb_size_t itor = tb_binary_find_all_if(iterator, xm_string_charset_comp_by_name, name);
- if (itor != tb_iterator_tail(iterator))
+ if (itor != tb_iterator_tail(iterator)) {
return (xm_charset_entry_ref_t)tb_iterator_item(iterator, itor);
- else
+ } else {
return tb_null;
+ }
}
/* //////////////////////////////////////////////////////////////////////////////////////
@@ -115,9 +116,9 @@ tb_int_t xm_string_convert(lua_State *lua) {
tb_check_return_val(fcharset && tcharset, 0);
// empty string?
- if (!src_size)
+ if (!src_size) {
lua_pushstring(lua, "");
- else {
+ } else {
// convert string
tb_long_t dst_size = 0;
tb_size_t dst_maxn = (tb_size_t)src_size << 2;
@@ -131,8 +132,9 @@ tb_int_t xm_string_convert(lua_State *lua) {
dst_maxn)) >= 0 &&
dst_size < dst_maxn) {
lua_pushlstring(lua, (tb_char_t const *)dst_data, dst_size);
- } else
+ } else {
lua_pushnil(lua);
+ }
tb_free(dst_data);
}