提交 0fc81c7d 编写于 作者: H Hongze Cheng

refact code

上级 f77d2b12
...@@ -108,7 +108,7 @@ int32_t parseJsontoTagData(const char *json, SArray *pTagVals, STag **ppTag, voi ...@@ -108,7 +108,7 @@ int32_t parseJsontoTagData(const char *json, SArray *pTagVals, STag **ppTag, voi
// SColData ================================ // SColData ================================
void tColDataInit(SColData *pColData, int16_t cid, int8_t type, int8_t smaOn); void tColDataInit(SColData *pColData, int16_t cid, int8_t type, int8_t smaOn);
void tColDataReset(SColData *pColData); void tColDataReset(SColData *pColData);
void tColDataClear(void *ph); void tColDataDestroy(void *ph);
int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal); int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal);
int32_t tColDataGetValue(SColData *pColData, int32_t iRow, SColVal *pColVal); int32_t tColDataGetValue(SColData *pColData, int32_t iRow, SColVal *pColVal);
int32_t tColDataCopy(SColData *pColDataSrc, SColData *pColDataDest); int32_t tColDataCopy(SColData *pColDataSrc, SColData *pColDataDest);
......
...@@ -681,7 +681,7 @@ int32_t tGetTSRow(uint8_t *p, STSRow2 **ppRow) { ...@@ -681,7 +681,7 @@ int32_t tGetTSRow(uint8_t *p, STSRow2 **ppRow) {
return n; return n;
} }
// STSchema // STSchema ========================================
int32_t tTSchemaCreate(int32_t sver, SSchema *pSchema, int32_t ncols, STSchema **ppTSchema) { int32_t tTSchemaCreate(int32_t sver, SSchema *pSchema, int32_t ncols, STSchema **ppTSchema) {
*ppTSchema = (STSchema *)taosMemoryMalloc(sizeof(STSchema) + sizeof(STColumn) * ncols); *ppTSchema = (STSchema *)taosMemoryMalloc(sizeof(STSchema) + sizeof(STColumn) * ncols);
if (*ppTSchema == NULL) { if (*ppTSchema == NULL) {
...@@ -721,9 +721,7 @@ void tTSchemaDestroy(STSchema *pTSchema) { ...@@ -721,9 +721,7 @@ void tTSchemaDestroy(STSchema *pTSchema) {
if (pTSchema) taosMemoryFree(pTSchema); if (pTSchema) taosMemoryFree(pTSchema);
} }
// STSRowBuilder // STag ========================================
// STag
static int tTagValCmprFn(const void *p1, const void *p2) { static int tTagValCmprFn(const void *p1, const void *p2) {
if (((STagVal *)p1)->cid < ((STagVal *)p2)->cid) { if (((STagVal *)p1)->cid < ((STagVal *)p2)->cid) {
return -1; return -1;
...@@ -1176,6 +1174,14 @@ STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder) { ...@@ -1176,6 +1174,14 @@ STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder) {
#endif #endif
// SColData ======================================== // SColData ========================================
void tColDataDestroy(void *ph) {
SColData *pColData = (SColData *)ph;
tFree(pColData->pBitMap);
tFree((uint8_t *)pColData->aOffset);
tFree(pColData->pData);
}
void tColDataInit(SColData *pColData, int16_t cid, int8_t type, int8_t smaOn) { void tColDataInit(SColData *pColData, int16_t cid, int8_t type, int8_t smaOn) {
pColData->cid = cid; pColData->cid = cid;
pColData->type = type; pColData->type = type;
...@@ -1189,14 +1195,6 @@ void tColDataReset(SColData *pColData) { ...@@ -1189,14 +1195,6 @@ void tColDataReset(SColData *pColData) {
pColData->nData = 0; pColData->nData = 0;
} }
void tColDataClear(void *ph) {
SColData *pColData = (SColData *)ph;
tFree(pColData->pBitMap);
tFree((uint8_t *)pColData->aOffset);
tFree(pColData->pData);
}
int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal) { int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal) {
int32_t code = 0; int32_t code = 0;
int64_t size; int64_t size;
......
...@@ -940,7 +940,7 @@ void tBlockDataDestroy(SBlockData *pBlockData, int8_t deepClear) { ...@@ -940,7 +940,7 @@ void tBlockDataDestroy(SBlockData *pBlockData, int8_t deepClear) {
tFree((uint8_t *)pBlockData->aVersion); tFree((uint8_t *)pBlockData->aVersion);
tFree((uint8_t *)pBlockData->aTSKEY); tFree((uint8_t *)pBlockData->aTSKEY);
taosArrayDestroy(pBlockData->aIdx); taosArrayDestroy(pBlockData->aIdx);
taosArrayDestroyEx(pBlockData->aColData, deepClear ? tColDataClear : NULL); taosArrayDestroyEx(pBlockData->aColData, deepClear ? tColDataDestroy : NULL);
pBlockData->aUid = NULL; pBlockData->aUid = NULL;
pBlockData->aVersion = NULL; pBlockData->aVersion = NULL;
pBlockData->aTSKEY = NULL; pBlockData->aTSKEY = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册