From fefa843c8674d083007edd71a249624694e9ffeb Mon Sep 17 00:00:00 2001 From: "Constantin P." <papizh.konstantin@demlabs.net> Date: Fri, 27 Sep 2024 14:02:44 +0700 Subject: [PATCH] ... --- crypto/include/dap_hash.h | 7 ++++++- crypto/src/dap_hash.c | 7 ------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/crypto/include/dap_hash.h b/crypto/include/dap_hash.h index ebd8b63e2..bb9302265 100755 --- a/crypto/include/dap_hash.h +++ b/crypto/include/dap_hash.h @@ -127,8 +127,13 @@ DAP_STATIC_INLINE int dap_chain_hash_fast_to_str(const dap_hash_fast_t *a_hash, return DAP_CHAIN_HASH_FAST_STR_SIZE; } -const char *dap_chain_hash_fast_to_str_static(const dap_hash_fast_t *a_hash); +DAP_STATIC_INLINE dap_hash_str_t dap_chain_hash_fast_to_hash_str(const dap_hash_fast_t *a_hash) { + dap_hash_str_t l_ret = { }; + dap_chain_hash_fast_to_str(a_hash, l_ret.s, DAP_CHAIN_HASH_FAST_STR_SIZE); + return l_ret; +} +#define dap_chain_hash_fast_to_str_static(hash) dap_chain_hash_fast_to_hash_str(hash).s #define dap_hash_fast_to_str dap_chain_hash_fast_to_str #define dap_hash_fast_to_str_static dap_chain_hash_fast_to_str_static diff --git a/crypto/src/dap_hash.c b/crypto/src/dap_hash.c index a54345830..94eda5d58 100755 --- a/crypto/src/dap_hash.c +++ b/crypto/src/dap_hash.c @@ -78,10 +78,3 @@ int dap_chain_hash_fast_from_str( const char *a_hash_str, dap_chain_hash_fast_t { return dap_chain_hash_fast_from_hex_str(a_hash_str, a_hash) && dap_chain_hash_fast_from_base58_str(a_hash_str, a_hash); } - -const char *dap_chain_hash_fast_to_str_static(const dap_hash_fast_t *a_hash) -{ - _Thread_local static char s_hash_str[DAP_HASH_FAST_STR_SIZE]; - return dap_chain_hash_fast_to_str(a_hash, s_hash_str, sizeof(s_hash_str)) == DAP_CHAIN_HASH_FAST_STR_SIZE - ? s_hash_str : NULL; -} -- GitLab