diff --git a/include/util/encode.h b/include/util/encode.h
index ba63759737f250e120390dc1c93e676cbb345824..7135a98f40b029e0d108e88297c75701218873ac 100644
--- a/include/util/encode.h
+++ b/include/util/encode.h
@@ -16,7 +16,7 @@
#ifndef _TD_UTIL_ENCODE_H_
#define _TD_UTIL_ENCODE_H_
-#include "freelist.h"
+#include "tfreelist.h"
#include "tcoding.h"
#include "tmacro.h"
diff --git a/include/util/freelist.h b/include/util/tfreelist.h
similarity index 97%
rename from include/util/freelist.h
rename to include/util/tfreelist.h
index 497a6d58c3f0791a90765f0682f5474ca8a2b6cf..c1913ebaf95866218db3d6b151a903f040e2175e 100644
--- a/include/util/freelist.h
+++ b/include/util/tfreelist.h
@@ -16,7 +16,6 @@
#ifndef _TD_UTIL_FREELIST_H_
#define _TD_UTIL_FREELIST_H_
-#include "os.h"
#include "tlist.h"
#ifdef __cplusplus
diff --git a/include/util/tlist.h b/include/util/tlist.h
index 134873a993f3721e860ec443da281e2443dd04a1..08d2e9b868de89f4deea4a4a62cea62660218506 100644
--- a/include/util/tlist.h
+++ b/include/util/tlist.h
@@ -12,8 +12,10 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-#ifndef _TD_UTIL_LIST_H
-#define _TD_UTIL_LIST_H
+#ifndef _TD_UTIL_LIST_H_
+#define _TD_UTIL_LIST_H_
+
+#include "os.h"
#ifdef __cplusplus
extern "C" {
@@ -28,12 +30,12 @@ extern "C" {
#define TD_SLIST(TYPE) \
struct { \
struct TYPE *sl_head_; \
- int sl_neles_; \
+ int32_t sl_neles_; \
}
-#define TD_SLIST_HEAD(sl) ((sl)->sl_head_)
-#define TD_SLIST_NELES(sl) ((sl)->sl_neles_)
-#define TD_SLIST_NODE_NEXT(sln) ((sln)->sl_next_)
+#define TD_SLIST_HEAD(sl) ((sl)->sl_head_)
+#define TD_SLIST_NELES(sl) ((sl)->sl_neles_)
+#define TD_SLIST_NODE_NEXT(sln) ((sln)->sl_next_)
#define TD_SLIST_NODE_NEXT_WITH_FIELD(sln, field) ((sln)->field.sl_next_)
#define TD_SLIST_INIT(sl) \
@@ -79,16 +81,16 @@ extern "C" {
struct { \
struct TYPE *dl_head_; \
struct TYPE *dl_tail_; \
- int dl_neles_; \
+ int32_t dl_neles_; \
}
-#define TD_DLIST_NODE_PREV(dln) ((dln)->dl_prev_)
-#define TD_DLIST_NODE_NEXT(dln) ((dln)->dl_next_)
+#define TD_DLIST_NODE_PREV(dln) ((dln)->dl_prev_)
+#define TD_DLIST_NODE_NEXT(dln) ((dln)->dl_next_)
#define TD_DLIST_NODE_PREV_WITH_FIELD(dln, field) ((dln)->field.dl_prev_)
#define TD_DLIST_NODE_NEXT_WITH_FIELD(dln, field) ((dln)->field.dl_next_)
-#define TD_DLIST_HEAD(dl) ((dl)->dl_head_)
-#define TD_DLIST_TAIL(dl) ((dl)->dl_tail_)
-#define TD_DLIST_NELES(dl) ((dl)->dl_neles_)
+#define TD_DLIST_HEAD(dl) ((dl)->dl_head_)
+#define TD_DLIST_TAIL(dl) ((dl)->dl_tail_)
+#define TD_DLIST_NELES(dl) ((dl)->dl_neles_)
#define TD_DLIST_INIT(dl) \
do { \
@@ -200,29 +202,29 @@ typedef struct SListNode {
typedef struct {
TD_DLIST(SListNode);
- int eleSize;
+ int32_t eleSize;
} SList;
typedef struct {
- SListNode * next;
+ SListNode *next;
TD_LIST_DIRECTION_T direction;
} SListIter;
-#define listHead(l) TD_DLIST_HEAD(l)
-#define listTail(l) TD_DLIST_TAIL(l)
-#define listNEles(l) TD_DLIST_NELES(l)
-#define listEleSize(l) ((l)->eleSize)
-#define isListEmpty(l) (TD_DLIST_NELES(l) == 0)
+#define listHead(l) TD_DLIST_HEAD(l)
+#define listTail(l) TD_DLIST_TAIL(l)
+#define listNEles(l) TD_DLIST_NELES(l)
+#define listEleSize(l) ((l)->eleSize)
+#define isListEmpty(l) (TD_DLIST_NELES(l) == 0)
#define listNodeFree(n) free(n)
-void tdListInit(SList *list, int eleSize);
+void tdListInit(SList *list, int32_t eleSize);
void tdListEmpty(SList *list);
-SList * tdListNew(int eleSize);
-void * tdListFree(SList *list);
+SList *tdListNew(int32_t eleSize);
+void *tdListFree(SList *list);
void tdListPrependNode(SList *list, SListNode *node);
void tdListAppendNode(SList *list, SListNode *node);
-int tdListPrepend(SList *list, void *data);
-int tdListAppend(SList *list, void *data);
+int32_t tdListPrepend(SList *list, void *data);
+int32_t tdListAppend(SList *list, void *data);
SListNode *tdListPopHead(SList *list);
SListNode *tdListPopTail(SList *list);
SListNode *tdListGetHead(SList *list);
@@ -239,4 +241,4 @@ SListNode *tdListNext(SListIter *pIter);
}
#endif
-#endif /*_TD_UTIL_LIST_H*/
\ No newline at end of file
+#endif /*_TD_UTIL_LIST_H_*/
\ No newline at end of file
diff --git a/source/util/inc/utilInt.h b/source/util/inc/utilInt.h
deleted file mode 100644
index ae2bad792d8777283b9289516cb748ce21142651..0000000000000000000000000000000000000000
--- a/source/util/inc/utilInt.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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 .
- */
-
-#ifndef _TD_UTIL_INT_H_
-#define _TD_UTIL_INT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*_TD_UTIL_INT_H_*/
\ No newline at end of file
diff --git a/source/util/src/tlist.c b/source/util/src/tlist.c
index f79bca1e4b03377cdfdaeda9ad4adf06ddff6de4..5fccba614b5c65beb6893ad0be64a61732bb200d 100644
--- a/source/util/src/tlist.c
+++ b/source/util/src/tlist.c
@@ -13,15 +13,15 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
#include "tlist.h"
-#include "os.h"
-void tdListInit(SList *list, int eleSize) {
+void tdListInit(SList *list, int32_t eleSize) {
TD_DLIST_INIT(list);
listEleSize(list) = eleSize;
}
-SList *tdListNew(int eleSize) {
+SList *tdListNew(int32_t eleSize) {
SList *list = (SList *)malloc(sizeof(SList));
if (list == NULL) return NULL;
@@ -50,7 +50,7 @@ void tdListPrependNode(SList *list, SListNode *node) { TD_DLIST_PREPEND(list, no
void tdListAppendNode(SList *list, SListNode *node) { TD_DLIST_APPEND(list, node); }
-int tdListPrepend(SList *list, void *data) {
+int32_t tdListPrepend(SList *list, void *data) {
SListNode *node = (SListNode *)malloc(sizeof(SListNode) + list->eleSize);
if (node == NULL) return -1;
@@ -60,7 +60,7 @@ int tdListPrepend(SList *list, void *data) {
return 0;
}
-int tdListAppend(SList *list, void *data) {
+int32_t tdListAppend(SList *list, void *data) {
SListNode *node = (SListNode *)calloc(1, sizeof(SListNode) + list->eleSize);
if (node == NULL) return -1;
diff --git a/source/util/test/freelistTest.cpp b/source/util/test/freelistTest.cpp
index 7a4e8be5b7f908fdccfe524c2ec2729a6090ec90..cf11d6b5bf461a19ce4a6ee231ee92d0c5fbdb8b 100644
--- a/source/util/test/freelistTest.cpp
+++ b/source/util/test/freelistTest.cpp
@@ -1,6 +1,6 @@
#include "gtest/gtest.h"
-#include "freelist.h"
+#include "tfreelist.h"
TEST(TD_UTIL_FREELIST_TEST, simple_test) {
SFreeList fl;