diff --git a/include/os/os.h b/include/os/os.h
index d96f7efb51..f020af5a65 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 cedf26d04a..3ff3b50550 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 5f1d5a9a8a..6100419035 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 78112fc7a0..7fb9a2202d 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 af99e4b474..395874a88c 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 9f9061d243..a0771dc734 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 79834dc9a5..cccc13755d 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