Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
40ba2bd8
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
40ba2bd8
编写于
2月 28, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tlist
上级
39bf54bb
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
34 addition
and
60 deletion
+34
-60
include/util/encode.h
include/util/encode.h
+1
-1
include/util/tfreelist.h
include/util/tfreelist.h
+0
-1
include/util/tlist.h
include/util/tlist.h
+27
-25
source/util/inc/utilInt.h
source/util/inc/utilInt.h
+0
-27
source/util/src/tlist.c
source/util/src/tlist.c
+5
-5
source/util/test/freelistTest.cpp
source/util/test/freelistTest.cpp
+1
-1
未找到文件。
include/util/encode.h
浏览文件 @
40ba2bd8
...
...
@@ -16,7 +16,7 @@
#ifndef _TD_UTIL_ENCODE_H_
#define _TD_UTIL_ENCODE_H_
#include "freelist.h"
#include "
t
freelist.h"
#include "tcoding.h"
#include "tmacro.h"
...
...
include/util/freelist.h
→
include/util/
t
freelist.h
浏览文件 @
40ba2bd8
...
...
@@ -16,7 +16,6 @@
#ifndef _TD_UTIL_FREELIST_H_
#define _TD_UTIL_FREELIST_H_
#include "os.h"
#include "tlist.h"
#ifdef __cplusplus
...
...
include/util/tlist.h
浏览文件 @
40ba2bd8
...
...
@@ -12,8 +12,10 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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_; \
int
32_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_; \
int
32_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
;
int
32_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
,
int
32_t
eleSize
);
void
tdListEmpty
(
SList
*
list
);
SList
*
tdListNew
(
in
t
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
);
int
32_t
tdListPrepend
(
SList
*
list
,
void
*
data
);
int
32_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
source/util/inc/utilInt.h
已删除
100644 → 0
浏览文件 @
39bf54bb
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#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
source/util/src/tlist.c
浏览文件 @
40ba2bd8
...
...
@@ -13,15 +13,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "tlist.h"
#include "os.h"
void
tdListInit
(
SList
*
list
,
int
eleSize
)
{
void
tdListInit
(
SList
*
list
,
int
32_t
eleSize
)
{
TD_DLIST_INIT
(
list
);
listEleSize
(
list
)
=
eleSize
;
}
SList
*
tdListNew
(
int
eleSize
)
{
SList
*
tdListNew
(
int
32_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
)
{
int
32_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
)
{
int
32_t
tdListAppend
(
SList
*
list
,
void
*
data
)
{
SListNode
*
node
=
(
SListNode
*
)
calloc
(
1
,
sizeof
(
SListNode
)
+
list
->
eleSize
);
if
(
node
==
NULL
)
return
-
1
;
...
...
source/util/test/freelistTest.cpp
浏览文件 @
40ba2bd8
#include "gtest/gtest.h"
#include "freelist.h"
#include "
t
freelist.h"
TEST
(
TD_UTIL_FREELIST_TEST
,
simple_test
)
{
SFreeList
fl
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录