diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c
index 0180cc5ede..ecf865857e 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 35e14ecb5a..05d30579b1 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 38685855df..db84f87b66 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 8101c18ebf..2f174b44e6 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 6e845e7e9e..3ca0f00fc2 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 f6892b26bd..e061862856 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 91d91f0714..861b4dc093 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 f9755a43b9..ba1529ade7 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 218472e7c9..a05a5c6ae1 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 ee32a20920..f32698c98a 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 27f1d4947d..ceef12e986 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) \