提交 6065a1f7 编写于 作者: Z zhaoyanggh

taosdemo compile on linux

上级 b45c0d52
...@@ -9862,15 +9862,16 @@ static void* syncWriteInterlaceSml(threadInfo *pThreadInfo, uint32_t interlaceRo ...@@ -9862,15 +9862,16 @@ static void* syncWriteInterlaceSml(threadInfo *pThreadInfo, uint32_t interlaceRo
batchPerTblTimes = 1; batchPerTblTimes = 1;
} }
char *smlHead = calloc(pThreadInfo->ntables, sizeof(char *)); char **smlHeadList = calloc(pThreadInfo->ntables, sizeof(char *));
assert(smlHead); assert(smlHeadList);
for (int t = 0; t < pThreadInfo->ntables; t++) { for (int t = 0; t < pThreadInfo->ntables; t++) {
smlHead[t] = (char *)calloc(HEAD_BUFF_LEN, 1); char* smlHead = *((char **)smlHeadList + t * sizeof(char *));
if (NULL == smlHead[t]) { smlHead = (char *)calloc(HEAD_BUFF_LEN, 1);
if (NULL == smlHead) {
errorPrint2("calloc failed! size:%d\n", HEAD_BUFF_LEN); errorPrint2("calloc failed! size:%d\n", HEAD_BUFF_LEN);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
generateSmlHead(smlHead[t], stbInfo, pThreadInfo, t); generateSmlHead(smlHead, stbInfo, pThreadInfo, t);
} }
...@@ -9920,7 +9921,7 @@ static void* syncWriteInterlaceSml(threadInfo *pThreadInfo, uint32_t interlaceRo ...@@ -9920,7 +9921,7 @@ static void* syncWriteInterlaceSml(threadInfo *pThreadInfo, uint32_t interlaceRo
errorPrint2("Failed to alloc %d bytes, reason:%s\n", errorPrint2("Failed to alloc %d bytes, reason:%s\n",
BUFFER_SIZE, strerror(errno)); BUFFER_SIZE, strerror(errno));
} }
generateSmlTail(pThreadInfo->lines[j], smlHead[i], stbInfo, pThreadInfo, timestamp); generateSmlTail(pThreadInfo->lines[j], *((char **)smlHeadList + i * sizeof(char *)), stbInfo, pThreadInfo, timestamp);
timestamp += timeStampStep; timestamp += timeStampStep;
} }
tableSeq ++; tableSeq ++;
...@@ -10039,8 +10040,9 @@ static void* syncWriteInterlaceSml(threadInfo *pThreadInfo, uint32_t interlaceRo ...@@ -10039,8 +10040,9 @@ static void* syncWriteInterlaceSml(threadInfo *pThreadInfo, uint32_t interlaceRo
free_of_interlace: free_of_interlace:
tmfree(pThreadInfo->lines); tmfree(pThreadInfo->lines);
for (int index = 0; index < pThreadInfo->ntables; index++) { for (int index = 0; index < pThreadInfo->ntables; index++) {
free(smlHead[index]); tmfree(*(smlHeadList + index*(sizeof(char*))));
} }
tmfree(smlHeadList);
printStatPerThread(pThreadInfo); printStatPerThread(pThreadInfo);
return NULL; return NULL;
} }
...@@ -10464,15 +10466,16 @@ static void* syncWriteProgressiveSml(threadInfo *pThreadInfo) { ...@@ -10464,15 +10466,16 @@ static void* syncWriteProgressiveSml(threadInfo *pThreadInfo) {
pThreadInfo->samplePos = 0; pThreadInfo->samplePos = 0;
char *smlHead = calloc(pThreadInfo->ntables, sizeof(char *)); char *smlHeadList = calloc(pThreadInfo->ntables, sizeof(char *));
assert(smlHead); assert(smlHeadList);
for (int t = 0; t < pThreadInfo->ntables; t++) { for (int t = 0; t < pThreadInfo->ntables; t++) {
smlHead[t] = (char *)calloc(HEAD_BUFF_LEN, 1); char* smlHead = *((char**)smlHeadList + t * sizeof(char *));
if (NULL == smlHead[t]) { smlHead = (char *)calloc(HEAD_BUFF_LEN, 1);
if (NULL == smlHead) {
errorPrint2("calloc failed! size:%d\n", HEAD_BUFF_LEN); errorPrint2("calloc failed! size:%d\n", HEAD_BUFF_LEN);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
generateSmlHead(smlHead[t], stbInfo, pThreadInfo, t); generateSmlHead(smlHead, stbInfo, pThreadInfo, t);
} }
int currentPercent = 0; int currentPercent = 0;
...@@ -10499,7 +10502,7 @@ static void* syncWriteProgressiveSml(threadInfo *pThreadInfo) { ...@@ -10499,7 +10502,7 @@ static void* syncWriteProgressiveSml(threadInfo *pThreadInfo) {
errorPrint2("Failed to alloc %d bytes, reason:%s\n", errorPrint2("Failed to alloc %d bytes, reason:%s\n",
BUFFER_SIZE, strerror(errno)); BUFFER_SIZE, strerror(errno));
} }
generateSmlTail(pThreadInfo->lines[k], smlHead[i], stbInfo, pThreadInfo, timestamp); generateSmlTail(pThreadInfo->lines[k], *((char**)smlHeadList + i * sizeof(char *)), stbInfo, pThreadInfo, timestamp);
timestamp += timeStampStep; timestamp += timeStampStep;
j++; j++;
if (j == insertRows) { if (j == insertRows) {
...@@ -10555,8 +10558,9 @@ static void* syncWriteProgressiveSml(threadInfo *pThreadInfo) { ...@@ -10555,8 +10558,9 @@ static void* syncWriteProgressiveSml(threadInfo *pThreadInfo) {
} }
tmfree(pThreadInfo->lines); tmfree(pThreadInfo->lines);
for (int index = 0; index < pThreadInfo->ntables; index++) { for (int index = 0; index < pThreadInfo->ntables; index++) {
free(smlHead[index]); free(*((char**)smlHeadList + index * sizeof(char *)));
} }
tmfree(smlHeadList);
return NULL; return NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册