未验证 提交 8171e326 编写于 作者: wafwerar's avatar wafwerar 提交者: GitHub

Merge pull request #14227 from taosdata/fix/ZhiqiangWang/TD-16357-add-alloca-func

os: add alloca func
......@@ -52,6 +52,7 @@ extern "C" {
#endif
#else
#include <malloc.h>
#include <time.h>
#ifndef TD_USE_WINSOCK
#include <winsock2.h>
......
......@@ -25,11 +25,10 @@ extern "C" {
#define TSWAP(a, b) \
do { \
char *__tmp = taosMemoryMalloc(sizeof(a)); \
char *__tmp = alloca(sizeof(a)); \
memcpy(__tmp, &(a), sizeof(a)); \
memcpy(&(a), &(b), sizeof(a)); \
memcpy(&(b), __tmp, sizeof(a)); \
taosMemoryFree(__tmp); \
} while (0)
#ifdef WINDOWS
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册