diff --git a/include/os/os.h b/include/os/os.h
index d96f7efb51dd0ca36d307308ba005d4fd7f628b6..f020af5a657dcb3bcaf997ba0a68e6e57ca31b23 100644
--- a/include/os/os.h
+++ b/include/os/os.h
@@ -13,8 +13,8 @@
* along with this program. If not, see .
*/
-#ifndef TDENGINE_OS_H
-#define TDENGINE_OS_H
+#ifndef _TD_OS_H_
+#define _TD_OS_H_
#ifdef __cplusplus
extern "C" {
@@ -82,4 +82,4 @@ void osInit();
}
#endif
-#endif
+#endif /*_TD_OS_H_*/
diff --git a/include/os/osFile.h b/include/os/osFile.h
index cedf26d04aa1573c3ee0a066885c0a995fd5597c..3ff3b50550f563ad67378e1d5173b1ddb121601b 100644
--- a/include/os/osFile.h
+++ b/include/os/osFile.h
@@ -16,12 +16,12 @@
#ifndef _TD_OS_FILE_H_
#define _TD_OS_FILE_H_
+#include "osSocket.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-#include "osSocket.h"
-
#ifndef ALLOW_FORBID_FUNC
#define open OPEN_FUNC_TAOS_FORBID
#define fopen FOPEN_FUNC_TAOS_FORBID
diff --git a/include/os/osMemory.h b/include/os/osMemory.h
index 5f1d5a9a8a6a7028295cac28d6711f6171be7307..6100419035ff9901bf6a6d5c3871496d0edcd533 100644
--- a/include/os/osMemory.h
+++ b/include/os/osMemory.h
@@ -20,12 +20,12 @@
extern "C" {
#endif
-#define tfree(x) \
- do { \
- if (x) { \
+#define tfree(x) \
+ do { \
+ if (x) { \
free((void *)(x)); \
(x) = 0; \
- } \
+ } \
} while (0)
#ifdef __cplusplus
diff --git a/include/os/osSemaphore.h b/include/os/osSemaphore.h
index 78112fc7a0f58d0659cdbd0043c47e814ca69ca0..7fb9a2202d38760e5f1c760fe9d7f8eaa4096f46 100644
--- a/include/os/osSemaphore.h
+++ b/include/os/osSemaphore.h
@@ -16,12 +16,12 @@
#ifndef _TD_OS_SEMPHONE_H_
#define _TD_OS_SEMPHONE_H_
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-
#if defined (_TD_DARWIN_64)
typedef struct tsem_s *tsem_t;
int tsem_init(tsem_t *sem, int pshared, unsigned int value);
diff --git a/include/os/osSocket.h b/include/os/osSocket.h
index af99e4b47419350e408d8809e8d593d0b2a3996a..395874a88c5bded90fad93e781ba187e7ec911b1 100644
--- a/include/os/osSocket.h
+++ b/include/os/osSocket.h
@@ -16,10 +16,6 @@
#ifndef _TD_OS_SOCKET_H_
#define _TD_OS_SOCKET_H_
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
#include "winsock2.h"
#include
@@ -30,6 +26,10 @@ extern "C" {
#include
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define TAOS_EPOLL_WAIT_TIME 500
typedef int32_t SOCKET;
typedef SOCKET EpollFd;
diff --git a/include/os/osSysinfo.h b/include/os/osSysinfo.h
index 9f9061d2437f64bbad065ca7a28e35e3504dcec8..a0771dc7340562787a0e8bd69fbb880998fb8dcc 100644
--- a/include/os/osSysinfo.h
+++ b/include/os/osSysinfo.h
@@ -16,12 +16,12 @@
#ifndef _TD_OS_SYSINFO_H_
#define _TD_OS_SYSINFO_H_
+#include "os.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-#include "os.h"
-
typedef struct {
int64_t total;
int64_t used;
diff --git a/include/os/osThread.h b/include/os/osThread.h
index 79834dc9a59f00c0aefa452c2427ea45ac35c478..cccc13755d3a33f0ecaa1173df391228d3c90da9 100644
--- a/include/os/osThread.h
+++ b/include/os/osThread.h
@@ -16,12 +16,12 @@
#ifndef _TD_OS_THREAD_H_
#define _TD_OS_THREAD_H_
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-
#ifdef __cplusplus
}
#endif