diff --git a/include/common/tmsg.h b/include/common/tmsg.h index f77a75b3f6..4eb64785df 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -3639,9 +3639,9 @@ static FORCE_INLINE void tqOffsetResetToLog(STqOffsetVal* pOffsetVal, int64_t ve int32_t tEncodeSTqOffsetVal(SEncoder* pEncoder, const STqOffsetVal* pOffsetVal); int32_t tDecodeSTqOffsetVal(SDecoder* pDecoder, STqOffsetVal* pOffsetVal); -int32_t tFormatOffset(char* buf, int32_t maxLen, const STqOffsetVal* pVal); +void tFormatOffset(char* buf, int32_t maxLen, const STqOffsetVal* pVal); bool tOffsetEqual(const STqOffsetVal* pLeft, const STqOffsetVal* pRight); -int32_t tOffsetCopy(STqOffsetVal* pLeft, const STqOffsetVal* pRight); +void tOffsetCopy(STqOffsetVal* pLeft, const STqOffsetVal* pRight); void tOffsetDestroy(void* pVal); typedef struct { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index a4f854a59e..927bb3a802 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -9194,7 +9194,7 @@ int32_t tDecodeSTqOffsetVal(SDecoder *pDecoder, STqOffsetVal *pOffsetVal) { return 0; } -int32_t tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) { +void tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) { if (pVal->type == TMQ_OFFSET__RESET_NONE) { (void)snprintf(buf, maxLen, "none"); } else if (pVal->type == TMQ_OFFSET__RESET_EARLIEST) { @@ -9206,7 +9206,7 @@ int32_t tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) { } else if (pVal->type == TMQ_OFFSET__SNAPSHOT_DATA || pVal->type == TMQ_OFFSET__SNAPSHOT_META) { if (IS_VAR_DATA_TYPE(pVal->primaryKey.type)) { char *tmp = taosMemoryCalloc(1, pVal->primaryKey.nData + 1); - if (tmp == NULL) return terrno; + if (tmp == NULL) return; (void)memcpy(tmp, pVal->primaryKey.pData, pVal->primaryKey.nData); (void)snprintf(buf, maxLen, "tsdb:%" PRId64 "|%" PRId64 ",pk type:%d,val:%s", pVal->uid, pVal->ts, pVal->primaryKey.type, tmp); @@ -9216,8 +9216,6 @@ int32_t tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) { pVal->primaryKey.type, pVal->primaryKey.val); } } - - return 0; } bool tOffsetEqual(const STqOffsetVal *pLeft, const STqOffsetVal *pRight) { @@ -9240,16 +9238,17 @@ bool tOffsetEqual(const STqOffsetVal *pLeft, const STqOffsetVal *pRight) { return false; } -int32_t tOffsetCopy(STqOffsetVal *pLeft, const STqOffsetVal *pRight) { +void tOffsetCopy(STqOffsetVal *pLeft, const STqOffsetVal *pRight) { tOffsetDestroy(pLeft); *pLeft = *pRight; if (IS_VAR_DATA_TYPE(pRight->primaryKey.type)) { - if ((pLeft->primaryKey.pData = taosMemoryMalloc(pRight->primaryKey.nData)) == NULL) { - return terrno; + pLeft->primaryKey.pData = taosMemoryMalloc(pRight->primaryKey.nData); + if (pLeft->primaryKey.pData == NULL) { + uError("failed to allocate memory for offset"); + return; } (void)memcpy(pLeft->primaryKey.pData, pRight->primaryKey.pData, pRight->primaryKey.nData); } - return 0; } void tOffsetDestroy(void *param) {