提交 d148a8e9 编写于 作者: H hzcheng

TD-34

上级 d5e4fc32
......@@ -24,7 +24,7 @@ SList *tdListNew(int eleSize) {
list->eleSize = eleSize;
list->numOfEles = 0;
list->head = list->tail = NULL;
return NULL;
return list;
}
void tdListEmpty(SList *list) {
......@@ -135,7 +135,7 @@ SListNode *tdListPopNode(SList *list, SListNode *node) {
return node;
}
void tdListNodeGetData(SList *list, SListNode *node, void *target) { memcpy(node->data, target, list->eleSize); }
void tdListNodeGetData(SList *list, SListNode *node, void *target) { memcpy(target, node->data, list->eleSize); }
void tdListInitIter(SList *list, SListIter *pIter, TD_LIST_DIRECTION_T direction) {
pIter->direction = direction;
......
......@@ -23,6 +23,8 @@ STsdbCache *tsdbInitCache(int maxBytes, int cacheBlockSize) {
STsdbCache *pCache = (STsdbCache *)calloc(1, sizeof(STsdbCache));
if (pCache == NULL) return NULL;
if (cacheBlockSize < 0) cacheBlockSize = TSDB_DEFAULT_CACHE_BLOCK_SIZE;
pCache->maxBytes = maxBytes;
pCache->cacheBlockSize = cacheBlockSize;
......@@ -83,6 +85,7 @@ void *tsdbAllocFromCache(STsdbCache *pCache, int bytes) {
void *ptr = (void *)(pCache->curBlock->data + pCache->curBlock->offset);
pCache->curBlock->offset += bytes;
pCache->curBlock->remain -= bytes;
memset(ptr, 0, bytes);
return ptr;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册