diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c
index 0180cc5ede1526748b05986da7001a84b70138ea..ecf865857efccfc1b4b92d69b60990aca6d4fb6a 100644
--- a/source/common/src/tdataformat.c
+++ b/source/common/src/tdataformat.c
@@ -12,11 +12,10 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
+
+#define _DEFAULT_SOURCE
#include "tdataformat.h"
-#include "talgo.h"
-#include "tcoding.h"
-#include "wchar.h"
-#include "tarray.h"
+#include "tcoding.h"
#include "tlog.h"
static void dataColSetNEleNull(SDataCol *pCol, int nEle);
diff --git a/source/common/src/tep.c b/source/common/src/tep.c
index 35e14ecb5a52ca5bb375ecb0903b219b3e44a5fe..05d30579b12632cd5cfb4189af35440a3ee373ce 100644
--- a/source/common/src/tep.c
+++ b/source/common/src/tep.c
@@ -17,7 +17,6 @@
#include "tep.h"
#include "tcompare.h"
#include "tglobal.h"
-#include "tlockfree.h"
int32_t taosGetFqdnPortFromEp(const char *ep, SEp* pEp) {
pEp->port = 0;
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index 38685855df2f3dd5aed31ba862dd646aa2b941cb..db84f87b66c77fd636eb6df1d04efe6c82d108f8 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -14,16 +14,11 @@
*/
#define _DEFAULT_SOURCE
-#include "os.h"
-
-#include "taosdef.h"
-#include "taoserror.h"
+#include "tglobal.h"
#include "tcompare.h"
#include "tconfig.h"
#include "tep.h"
-#include "tglobal.h"
#include "tlog.h"
-#include "tutil.h"
SConfig *tsCfg = NULL;
diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c
index 8101c18ebf43ce78fb119c77d8eeca6aea6fbd6e..2f174b44e6833848e6ec540ffec4eaeba97124ac 100644
--- a/source/common/src/tmsg.c
+++ b/source/common/src/tmsg.c
@@ -13,6 +13,7 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
#include "tmsg.h"
#undef TD_MSG_NUMBER_
diff --git a/source/common/src/tmsgtype.c b/source/common/src/tmsgtype.c
index 6e845e7e9e4f1a7c4b0474e51e11c6e6e3d8f6c9..3ca0f00fc20df54226eb026e2c92e19144de47b2 100644
--- a/source/common/src/tmsgtype.c
+++ b/source/common/src/tmsgtype.c
@@ -13,6 +13,6 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
#define TSDB_SQL_C
-
#include "tmsgtype.h"
diff --git a/source/common/src/tname.c b/source/common/src/tname.c
index f6892b26bdb0fc167548d1d95287e5f21bbf6678..e061862856702c8015470afb496bd5e6734e49b6 100644
--- a/source/common/src/tname.c
+++ b/source/common/src/tname.c
@@ -1,9 +1,20 @@
-#include
-#include "os.h"
-#include "tutil.h"
-
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#define _DEFAULT_SOURCE
#include "tname.h"
-#include "tmsg.h"
#define VALID_NAME_TYPE(x) ((x) == TSDB_DB_NAME_T || (x) == TSDB_TABLE_NAME_T)
diff --git a/source/common/src/trow.c b/source/common/src/trow.c
index 91d91f0714d475d427dd7087b27d64fb3f60faf6..861b4dc09334beb2d62e7e0677519c448855a38f 100644
--- a/source/common/src/trow.c
+++ b/source/common/src/trow.c
@@ -13,8 +13,8 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
#include "trow.h"
-#include "tarray.h"
const uint8_t tdVTypeByte[3] = {
TD_VTYPE_NORM_BYTE, // TD_VTYPE_NORM
diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c
index f9755a43b9c4a53473637110bd683556d6c64b10..ba1529ade7fdbe5814db56aa6fe016f512b91bf8 100644
--- a/source/common/src/ttime.c
+++ b/source/common/src/ttime.c
@@ -13,20 +13,15 @@
* along with this program. If not, see .
*/
-#define _BSD_SOURCE
-
#ifdef DARWIN
#define _XOPEN_SOURCE
#else
#define _XOPEN_SOURCE 500
#endif
+#define _BSD_SOURCE
#define _DEFAULT_SOURCE
-
-#include "os.h"
-#include "taosdef.h"
#include "ttime.h"
-#include "tutil.h"
/*
* mktime64 - Converts date to seconds.
diff --git a/source/common/src/ttszip.c b/source/common/src/ttszip.c
index 218472e7c91af013153ffd500b200258accfd905..a05a5c6ae1875271b92b122acd87c758f603e0e9 100644
--- a/source/common/src/ttszip.c
+++ b/source/common/src/ttszip.c
@@ -1,8 +1,22 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#define _DEFAULT_SOURCE
#include "ttszip.h"
-#include
#include "taoserror.h"
#include "tcompression.h"
-#include "tutil.h"
static int32_t getDataStartOffset();
static void TSBufUpdateGroupInfo(STSBuf* pTSBuf, int32_t index, STSGroupBlockInfo* pBlockInfo);
diff --git a/source/common/src/ttypes.c b/source/common/src/ttypes.c
index ee32a209203ace3e7b484c5729882d4ab57f8eab..f32698c98ad7179f2661c85fec2df3906aa76dc0 100644
--- a/source/common/src/ttypes.c
+++ b/source/common/src/ttypes.c
@@ -13,9 +13,8 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
#include "ttypes.h"
-#include "../../../include/client/taos.h"
-#include "os.h"
#include "tcompression.h"
const int32_t TYPE_BYTES[15] = {
diff --git a/source/common/src/tvariant.c b/source/common/src/tvariant.c
index 27f1d4947d999fa5e183b9283e82be719cb3eb01..ceef12e986105ad42b1322db26c20a19a760f740 100644
--- a/source/common/src/tvariant.c
+++ b/source/common/src/tvariant.c
@@ -12,14 +12,11 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-#include "os.h"
-#include "taos.h"
-#include "taosdef.h"
+#define _DEFAULT_SOURCE
+#include "tvariant.h"
#include "ttime.h"
#include "ttokendef.h"
-#include "ttypes.h"
-#include "tutil.h"
#include "tvariant.h"
#define SET_EXT_INFO(converted, res, minv, maxv, exti) \