summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-06-26 00:41:51 +0800
committerruki <[email protected]>2026-06-26 00:41:51 +0800
commitd4e1c04ca90958fa0fc618f3660975e1b6a07c8d (patch)
tree3b9e6c0d8cc7c3157ff4cf17901867e9162a98ed
parenta14d44e9710592a06cc725393d7ab10e5f263efc (diff)
fix compiler error
-rw-r--r--core/src/xmake/hash/xxhash.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/src/xmake/hash/xxhash.c b/core/src/xmake/hash/xxhash.c
index 77bf32dfe..4edcddb59 100644
--- a/core/src/xmake/hash/xxhash.c
+++ b/core/src/xmake/hash/xxhash.c
@@ -138,7 +138,7 @@ tb_int_t xm_hash_xxhash(lua_State *lua) {
}
// compuate hash
- tb_byte_t const *buffer;
+ tb_byte_t const *buffer = tb_null;
tb_uint32_t value32;
XXH64_hash_t value64;
XXH128_hash_t value128;
@@ -154,14 +154,14 @@ tb_int_t xm_hash_xxhash(lua_State *lua) {
buffer = (tb_byte_t const *)&value32;
}
- // make xxhash string
- tb_char_t s[256];
- tb_size_t n = mode >> 3;
- tb_size_t len = xm_hash_make_cstr(s, buffer, n);
+ if (buffer) {
+ tb_char_t s[256];
+ tb_size_t n = mode >> 3;
+ tb_size_t len = xm_hash_make_cstr(s, buffer, n);
- // save result
- lua_pushlstring(lua, s, len);
- ok = tb_true;
+ lua_pushlstring(lua, s, len);
+ ok = tb_true;
+ }
}
// exit stream