From 4226c900727ff7c7c86f492895c95b952356cd62 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 18 Jul 2022 15:25:28 +0800 Subject: [PATCH] fix: gcc 12 compile error (#15021) --- deps/lua/src/ldump.c | 2 +- src/kit/shell/src/shellEngine.c | 6 +++--- src/rpc/src/rpcMain.c | 6 +++--- src/util/src/tqueue.c | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/deps/lua/src/ldump.c b/deps/lua/src/ldump.c index f08277d3ac..4b20591488 100644 --- a/deps/lua/src/ldump.c +++ b/deps/lua/src/ldump.c @@ -60,7 +60,7 @@ static void DumpVector(const void* b, int n, size_t size, DumpState* D) static void DumpString(const TString* s, DumpState* D) { - if (s==NULL || getstr(s)==NULL) + if (s==NULL) { size_t size=0; DumpVar(size,D); diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index 83a8c42323..a9febf4c32 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -1150,12 +1150,12 @@ int parse_cloud_dsn() { } } char *port = strstr(args.cloudHost, ":"); - if ((port == NULL) || (port + strlen(":")) == NULL) { + if (port == NULL) { fprintf(stderr, "Invalid format in TDengine cloud dsn: %s\n", args.cloudDsn); return -1; } char *token = strstr(port + strlen(":"), "?token="); - if ((token == NULL) || (token + strlen("?token=")) == NULL || + if ((token == NULL) || (strlen(token + strlen("?token=")) == 0)) { fprintf(stderr, "Invalid format in TDengine cloud dsn: %s\n", args.cloudDsn); return -1; @@ -1651,4 +1651,4 @@ void wsclient_query(char *command) { } else { printf("Query OK, %" PRId64 " row(s) in set (%.6fs)\n\n", total_rows, (et - st) / 1E6); } -} \ No newline at end of file +} diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 95931fcbc6..4f67c6088d 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -361,8 +361,8 @@ void *rpcMallocCont(int contLen) { void rpcFreeCont(void *cont) { if (cont) { char *temp = ((char *)cont) - sizeof(SRpcHead) - sizeof(SRpcReqContext); - free(temp); tTrace("free mem: %p", temp); + free(temp); } } @@ -573,8 +573,8 @@ void rpcCancelRequest(int64_t rid) { static void rpcFreeMsg(void *msg) { if ( msg ) { char *temp = (char *)msg - sizeof(SRpcReqContext); - free(temp); tTrace("free mem: %p", temp); + free(temp); } } @@ -1683,4 +1683,4 @@ int32_t rpcUnusedSession(void * rpcInfo, bool bLock) { if(info == NULL) return 0; return taosIdPoolNumOfFree(info->idPool, bLock); -} \ No newline at end of file +} diff --git a/src/util/src/tqueue.c b/src/util/src/tqueue.c index 1ffa94b0df..7b23b708b1 100644 --- a/src/util/src/tqueue.c +++ b/src/util/src/tqueue.c @@ -86,9 +86,8 @@ void taosCloseQueue(taos_queue param) { } pthread_mutex_destroy(&queue->mutex); - free(queue); - uTrace("queue:%p is closed", queue); + free(queue); } void *taosAllocateQitem(int size) { -- GitLab