fix merge error

This commit is contained in:
Yihao Deng 2024-06-12 01:40:26 +00:00
parent 5c191e790f
commit 3cf063e135
1 changed files with 5 additions and 6 deletions

View File

@ -247,7 +247,7 @@ typedef struct {
int32_t compareHeapNode(const HeapNode* a, const HeapNode* b); int32_t compareHeapNode(const HeapNode* a, const HeapNode* b);
int transHeapCreate(SHeap* heap, int32_t (*cmpFunc)(const HeapNode* a, const HeapNode* b)); int transHeapCreate(SHeap* heap, int32_t (*cmpFunc)(const HeapNode* a, const HeapNode* b));
void transHeapDestroy(SHeap* heap); void transHeapDestroy(SHeap* heap);
void transHeapGet(SHeap* heap, SCliConn** p); int transHeapGet(SHeap* heap, SCliConn** p);
int transHeapInsert(SHeap* heap, SCliConn* p); int transHeapInsert(SHeap* heap, SCliConn* p);
int transHeapDelete(SHeap* heap, SCliConn* p); int transHeapDelete(SHeap* heap, SCliConn* p);
@ -1701,8 +1701,6 @@ static SCliConn* getConnFromHeapCache(SHashObj* pConnHeapCache, char* key) {
SHeap heap = {0}; SHeap heap = {0};
transHeapCreate(&heap, compareHeapNode); transHeapCreate(&heap, compareHeapNode);
taosHashPut(pConnHeapCache, key, klen, &heap, sizeof(heap)); taosHashPut(pConnHeapCache, key, klen, &heap, sizeof(heap));
p = taosHashGet(pConnHeapCache, key, strlen(key));
return NULL; return NULL;
} }
SCliConn* pConn = NULL; SCliConn* pConn = NULL;
@ -2985,18 +2983,19 @@ void transHeapDestroy(SHeap* heap) {
heapDestroy(heap->heap); heapDestroy(heap->heap);
} }
} }
void transHeapGet(SHeap* heap, SCliConn** p) { int transHeapGet(SHeap* heap, SCliConn** p) {
if (heapSize(heap->heap) == 0) { if (heapSize(heap->heap) == 0) {
*p = NULL; *p = NULL;
return; return -1;
} }
// HeapNode* minNode = headMin(heap->heap); // HeapNode* minNode = headMin(heap->heap);
HeapNode* minNode = heapMin(heap->heap); HeapNode* minNode = heapMin(heap->heap);
if (minNode == NULL) { if (minNode == NULL) {
*p = NULL; *p = NULL;
return; return -1;
} }
*p = container_of(minNode, SCliConn, node); *p = container_of(minNode, SCliConn, node);
return 0;
} }
int transHeapInsert(SHeap* heap, SCliConn* p) { int transHeapInsert(SHeap* heap, SCliConn* p) {
// impl later // impl later