From c2779c2181d4189a4e7cf9d3637f919183b4b58f Mon Sep 17 00:00:00 2001 From: Hui Li Date: Fri, 19 Jun 2020 18:27:34 +0800 Subject: [PATCH 1/3] [add init] --- src/kit/taosdump/taosdump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/kit/taosdump/taosdump.c b/src/kit/taosdump/taosdump.c index 7fa7ffa3a9..feef1ee81a 100644 --- a/src/kit/taosdump/taosdump.c +++ b/src/kit/taosdump/taosdump.c @@ -425,6 +425,7 @@ int taosGetTableRecordInfo(char *table, STableRecordInfo *pTableRecordInfo) { int taosDumpOut(SDumpArguments *arguments) { TAOS_ROW row; + TAOS_RES* result = NULL; char *temp = NULL; FILE *fp = NULL; int count = 0; @@ -464,7 +465,7 @@ int taosDumpOut(SDumpArguments *arguments) { taosDumpCharset(fp); sprintf(command, "show databases"); - TAOS_RES* result = taos_query(taos, command); + result = taos_query(taos, command); int32_t code = taos_errno(result); if (code != 0) { fprintf(stderr, "failed to run command: %s, reason: %s\n", command, taos_errstr(result)); From 78b1f5d632036672ed191f52287df992875c5804 Mon Sep 17 00:00:00 2001 From: Hui Li Date: Fri, 19 Jun 2020 18:31:11 +0800 Subject: [PATCH 2/3] [add init] --- src/kit/taosdump/taosdump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kit/taosdump/taosdump.c b/src/kit/taosdump/taosdump.c index feef1ee81a..ccef783709 100644 --- a/src/kit/taosdump/taosdump.c +++ b/src/kit/taosdump/taosdump.c @@ -572,7 +572,7 @@ int taosDumpOut(SDumpArguments *arguments) { fclose(fp); taos_close(taos); taos_free_result(result); - free(temp); + tfree(temp); taosFreeDbInfos(); return 0; @@ -580,7 +580,7 @@ _exit_failure: fclose(fp); taos_close(taos); taos_free_result(result); - free(temp); + tfree(temp); taosFreeDbInfos(); return -1; } From 6ce994b3e6219e100f2df1adbdb842502fe53833 Mon Sep 17 00:00:00 2001 From: Hui Li Date: Fri, 19 Jun 2020 18:41:22 +0800 Subject: [PATCH 3/3] [Back off using rand for performance] --- src/util/src/tutil.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/src/tutil.c b/src/util/src/tutil.c index 4469ad79b1..150767643f 100644 --- a/src/util/src/tutil.c +++ b/src/util/src/tutil.c @@ -36,6 +36,7 @@ uint32_t taosRand(void) #else uint32_t taosRand(void) { +/* int fd; int seed; @@ -51,6 +52,8 @@ uint32_t taosRand(void) } return (uint32_t)seed; +*/ + return rand(); } #endif