summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-11-09 21:38:38 +0800
committerruki <[email protected]>2025-11-09 21:38:38 +0800
commitf2f3821a0248b24941566c90e7aabcc0e7d95e77 (patch)
treee139715ac4dafd06e95f4018264e69a864316e02
parent1b8d7a8ef65e54bfd86d5cafbab9f197974b0c82 (diff)
format more code
-rw-r--r--.clang-format10
-rw-r--r--core/src/xmake/bloom_filter/bloom_filter_data.c3
-rw-r--r--core/src/xmake/bloom_filter/bloom_filter_open.c3
-rw-r--r--core/src/xmake/hash/md5.c3
-rw-r--r--core/src/xmake/hash/sha.c3
-rw-r--r--core/src/xmake/hash/xxhash.c6
-rw-r--r--core/src/xmake/thread/sharedata_get.c3
-rw-r--r--core/src/xmake/thread/sharedata_set.c3
8 files changed, 18 insertions, 16 deletions
diff --git a/.clang-format b/.clang-format
index 2fbb26713..8f5c54331 100644
--- a/.clang-format
+++ b/.clang-format
@@ -11,6 +11,16 @@ UseTab: Never
# Braces
BreakBeforeBraces: Attach
+BraceWrapping:
+ AfterControlStatement: false
+ AfterFunction: false
+ AfterEnum: false
+ AfterClass: false
+ AfterStruct: false
+ AfterUnion: false
+ BeforeElse: false
+ BeforeCatch: false
+ BeforeLambdaBody: false
# Alignment
AlignAfterOpenBracket: Align
diff --git a/core/src/xmake/bloom_filter/bloom_filter_data.c b/core/src/xmake/bloom_filter/bloom_filter_data.c
index d60b97d11..d622a6f31 100644
--- a/core/src/xmake/bloom_filter/bloom_filter_data.c
+++ b/core/src/xmake/bloom_filter/bloom_filter_data.c
@@ -49,8 +49,7 @@ tb_int_t xm_bloom_filter_data(lua_State *lua) {
tb_pointer_t data = (tb_pointer_t)tb_bloom_filter_data(filter);
if (data) {
xm_lua_pushpointer(lua, data);
- }
- else {
+ } else {
lua_pushnil(lua);
}
return 1;
diff --git a/core/src/xmake/bloom_filter/bloom_filter_open.c b/core/src/xmake/bloom_filter/bloom_filter_open.c
index a97ab6d81..4cd79e73f 100644
--- a/core/src/xmake/bloom_filter/bloom_filter_open.c
+++ b/core/src/xmake/bloom_filter/bloom_filter_open.c
@@ -50,8 +50,7 @@ tb_int_t xm_bloom_filter_open(lua_State *lua) {
tb_bloom_filter_ref_t filter = tb_bloom_filter_init(probability, hash_count, item_maxn, tb_element_str(tb_true));
if (filter) {
xm_lua_pushpointer(lua, (tb_pointer_t)filter);
- }
- else {
+ } else {
lua_pushnil(lua);
}
return 1;
diff --git a/core/src/xmake/hash/md5.c b/core/src/xmake/hash/md5.c
index d07c355e4..6d18b72ba 100644
--- a/core/src/xmake/hash/md5.c
+++ b/core/src/xmake/hash/md5.c
@@ -83,8 +83,7 @@ tb_int_t xm_hash_md5(lua_State *lua) {
if (real > 0) {
tb_md5_spak(&md5, data, real);
// no data? continue it
- }
- else if (!real) {
+ } else if (!real) {
// wait
real = tb_stream_wait(stream, TB_STREAM_WAIT_READ, tb_stream_timeout(stream));
tb_check_break(real > 0);
diff --git a/core/src/xmake/hash/sha.c b/core/src/xmake/hash/sha.c
index 4fddb0b83..7ddcab62f 100644
--- a/core/src/xmake/hash/sha.c
+++ b/core/src/xmake/hash/sha.c
@@ -90,8 +90,7 @@ tb_int_t xm_hash_sha(lua_State *lua) {
if (real > 0) {
tb_sha_spak(&sha, data, real);
// no data? continue it
- }
- else if (!real) {
+ } else if (!real) {
// wait
real = tb_stream_wait(stream, TB_STREAM_WAIT_READ, tb_stream_timeout(stream));
tb_check_break(real > 0);
diff --git a/core/src/xmake/hash/xxhash.c b/core/src/xmake/hash/xxhash.c
index 035ba4497..a7fe4a985 100644
--- a/core/src/xmake/hash/xxhash.c
+++ b/core/src/xmake/hash/xxhash.c
@@ -105,8 +105,7 @@ tb_int_t xm_hash_xxhash(lua_State *lua) {
// reset xxhash
if (mode == 32 || mode == 64) {
XM_XXH3_64bits_reset(state);
- }
- else {
+ } else {
XM_XXH3_128bits_reset(state);
}
@@ -119,8 +118,7 @@ tb_int_t xm_hash_xxhash(lua_State *lua) {
if (real > 0) {
if (mode == 32 || mode == 64) {
XM_XXH3_64bits_update(state, data, real);
- }
- else {
+ } else {
XM_XXH3_128bits_update(state, data, real);
}
}
diff --git a/core/src/xmake/thread/sharedata_get.c b/core/src/xmake/thread/sharedata_get.c
index cffc5860c..51ebdf62f 100644
--- a/core/src/xmake/thread/sharedata_get.c
+++ b/core/src/xmake/thread/sharedata_get.c
@@ -46,8 +46,7 @@ tb_int_t xm_thread_sharedata_get_(lua_State *lua) {
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;
diff --git a/core/src/xmake/thread/sharedata_set.c b/core/src/xmake/thread/sharedata_set.c
index 33f8a8561..9a4ad3cbd 100644
--- a/core/src/xmake/thread/sharedata_set.c
+++ b/core/src/xmake/thread/sharedata_set.c
@@ -47,8 +47,7 @@ tb_int_t xm_thread_sharedata_set(lua_State *lua) {
thread_sharedata->value.kind = (tb_uint32_t)XM_THREAD_VALUE_STR;
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)) {