TD-34
This commit is contained in:
parent
d5e4fc3201
commit
d148a8e9c3
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue