diff --git a/.clang-format b/.clang-format index 3ddd8b43f6238f30000b96d8e676892ab2dcec68..e58d518b3b8cacdd1e13dd965805fa364a996eb2 100644 --- a/.clang-format +++ b/.clang-format @@ -5,6 +5,7 @@ AccessModifierOffset: -1 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: true +AlignConsecutiveMacros: true AlignEscapedNewlinesLeft: true AlignOperands: true AlignTrailingComments: true diff --git a/source/libs/tdb/src/db/tdbEnv.c b/source/libs/tdb/src/db/tdbEnv.c index 6e74aefc626e2acbea58227945647454556012d2..a9e29d3f73a4888f46b7578d223fc2b61bcb7b7e 100644 --- a/source/libs/tdb/src/db/tdbEnv.c +++ b/source/libs/tdb/src/db/tdbEnv.c @@ -95,7 +95,7 @@ int tdbRollback(TENV *pEnv) { } SPager *tdbEnvGetPager(TENV *pEnv, const char *fname) { - int hash; + u32 hash; SPager **ppPager; hash = tdbCstringHash(fname); @@ -107,7 +107,7 @@ SPager *tdbEnvGetPager(TENV *pEnv, const char *fname) { } void tdbEnvAddPager(TENV *pEnv, SPager *pPager) { - int hash; + u32 hash; SPager **ppPager; // rehash if neccessary @@ -130,7 +130,7 @@ void tdbEnvAddPager(TENV *pEnv, SPager *pPager) { } void tdbEnvRemovePager(TENV *pEnv, SPager *pPager) { - int hash; + u32 hash; SPager **ppPager; // remove from the list diff --git a/source/libs/tdb/src/inc/tdbInt.h b/source/libs/tdb/src/inc/tdbInt.h index 26f92479522d68f1b03f8c4baeeba8e887eb7c1c..57e01f904cb8d45883585303d4ecf4f657719cbb 100644 --- a/source/libs/tdb/src/inc/tdbInt.h +++ b/source/libs/tdb/src/inc/tdbInt.h @@ -16,8 +16,6 @@ #ifndef _TD_TDB_INTERNAL_H_ #define _TD_TDB_INTERNAL_H_ -#include "os.h" - #include "tdb.h" #ifdef __cplusplus diff --git a/source/libs/tdb/src/inc/tdbOs.h b/source/libs/tdb/src/inc/tdbOs.h index 5259cfb4d311f21e09db74227fbae9d27f42aacc..ae389708f4f5cb3bd9dd1910f3a6568dc304f8ab 100644 --- a/source/libs/tdb/src/inc/tdbOs.h +++ b/source/libs/tdb/src/inc/tdbOs.h @@ -24,6 +24,8 @@ extern "C" { #define TDB_FOR_TDENGINE #ifdef TDB_FOR_TDENGINE +#include "os.h" +#include "thash.h" // For memory ----------------- #define tdbOsMalloc taosMemoryMalloc diff --git a/source/libs/tdb/src/inc/tdbUtil.h b/source/libs/tdb/src/inc/tdbUtil.h index a4cb09ea947861eb2598dd8a2d3a6f841e5cd3f3..6abddb5b22c22a3ac7c3099aeaf767cc9d0f03a2 100644 --- a/source/libs/tdb/src/inc/tdbUtil.h +++ b/source/libs/tdb/src/inc/tdbUtil.h @@ -101,10 +101,7 @@ static inline int tdbGetVarInt(const u8 *p, int *v) { return n; } -static inline int tdbCstringHash(const char *s) { - // TODO - return 0; -} +static inline u32 tdbCstringHash(const char *s) { return MurmurHash3_32(s, strlen(s)); } #ifdef __cplusplus }