“b5268dc3a0847dce2668265e07ff50d54265b2d8”上不存在“configs/git@gitcode.net:s920243400/PaddleOCR.git”
提交 5012ecc1 编写于 作者: H hjxilinx

add the test code for hashtable

上级 2a89ac7d
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
#ifndef TDENGINE_HASH_H #ifndef TDENGINE_HASH_H
#define TDENGINE_HASH_H #define TDENGINE_HASH_H
#ifdef __cplusplus
extern "C" {
#endif
#include "hashutil.h" #include "hashutil.h"
#define HASH_MAX_CAPACITY (1024 * 1024 * 16) #define HASH_MAX_CAPACITY (1024 * 1024 * 16)
...@@ -64,11 +68,12 @@ int32_t taosNumElemsInHashTable(HashObj *pObj); ...@@ -64,11 +68,12 @@ int32_t taosNumElemsInHashTable(HashObj *pObj);
char *taosGetDataFromHashTable(HashObj *pObj, const char *key, uint32_t keyLen); char *taosGetDataFromHashTable(HashObj *pObj, const char *key, uint32_t keyLen);
void taosCleanUpHashTable(void *handle); void taosCleanUpHashTable(void *handle);
int32_t taosGetHashMaxOverflowLength(HashObj *pObj); int32_t taosGetHashMaxOverflowLength(HashObj *pObj);
int32_t taosCheckHashTable(HashObj *pObj); #ifdef __cplusplus
}
#endif
#endif // TDENGINE_HASH_H #endif // TDENGINE_HASH_H
...@@ -340,10 +340,6 @@ static void doAddToHashTable(HashObj *pObj, SHashNode *pNode) { ...@@ -340,10 +340,6 @@ static void doAddToHashTable(HashObj *pObj, SHashNode *pNode) {
pEntry->num++; pEntry->num++;
pObj->size++; pObj->size++;
// char key[512] = {0};
// memcpy(key, pNode->key, MIN(512, pNode->keyLen));
// pTrace("key:%s %p add to hash table", key, pNode);
} }
int32_t taosNumElemsInHashTable(HashObj *pObj) { int32_t taosNumElemsInHashTable(HashObj *pObj) {
...@@ -525,29 +521,3 @@ int32_t taosGetHashMaxOverflowLength(HashObj* pObj) { ...@@ -525,29 +521,3 @@ int32_t taosGetHashMaxOverflowLength(HashObj* pObj) {
return num; return num;
} }
int32_t taosCheckHashTable(HashObj *pObj) {
for(int32_t i = 0; i < pObj->capacity; ++i) {
SHashEntry *pEntry = pObj->hashList[i];
SHashNode* pNode = pEntry->next;
if (pNode != NULL) {
assert(pEntry == pNode->prev1);
int32_t num = 1;
SHashNode* pNext = pNode->next;
while(pNext) {
assert(pNext->prev == pNode);
pNode = pNext;
pNext = pNext->next;
num ++;
}
assert(num == pEntry->num);
}
}
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册