diff --git a/include/os/os.h b/include/os/os.h index 254c16efbe..3e72a618a0 100644 --- a/include/os/os.h +++ b/include/os/os.h @@ -52,6 +52,7 @@ extern "C" { #endif #else +#include #include #ifndef TD_USE_WINSOCK #include diff --git a/include/os/osMath.h b/include/os/osMath.h index f17ca56c9e..e13c32422e 100644 --- a/include/os/osMath.h +++ b/include/os/osMath.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