Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
阿啄debugIT
libfastcommon
提交
08dce993
L
libfastcommon
项目概览
阿啄debugIT
/
libfastcommon
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libfastcommon
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
08dce993
编写于
7月 26, 2018
作者:
Y
yuqing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add file fc_list.h
上级
0bdb5e4b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
175 addition
and
1 deletion
+175
-1
HISTORY
HISTORY
+2
-1
src/fc_list.h
src/fc_list.h
+173
-0
未找到文件。
HISTORY
浏览文件 @
08dce993
Version 1.39 2018-07-2
3
Version 1.39 2018-07-2
6
* add #@function REPLACE_VARS
* #@set value can embed %{VARIABLE}
* shared_func.h: add function starts_with and ends_with
* common_blocked_queue.h: add function common_blocked_queue_try_pop
* sched_thread.c: fix first schedule time
* ini_file_reader add function iniGetRequiredStrValueEx
* add file fc_list.h
Version 1.38 2018-06-26
* connection_pool.c: set err_no to 0 when success
...
...
src/fc_list.h
0 → 100644
浏览文件 @
08dce993
#ifndef _FC_LIST_H
#define _FC_LIST_H
struct
fc_list_head
{
struct
fc_list_head
*
next
;
struct
fc_list_head
*
prev
;
};
#define FC_INIT_LIST_HEAD(head) \
do { \
(head)->next = (head)->prev = head; \
} while (0)
#ifdef __cplusplus
extern
"C"
{
#endif
static
inline
void
fc_list_add
(
struct
fc_list_head
*
_new
,
struct
fc_list_head
*
head
)
{
_new
->
prev
=
head
;
_new
->
next
=
head
->
next
;
_new
->
prev
->
next
=
_new
;
_new
->
next
->
prev
=
_new
;
}
static
inline
void
fc_list_add_tail
(
struct
fc_list_head
*
_new
,
struct
fc_list_head
*
head
)
{
_new
->
next
=
head
;
_new
->
prev
=
head
->
prev
;
_new
->
prev
->
next
=
_new
;
_new
->
next
->
prev
=
_new
;
}
static
inline
void
fc_list_add_internal
(
struct
fc_list_head
*
_new
,
struct
fc_list_head
*
prev
,
struct
fc_list_head
*
next
)
{
next
->
prev
=
_new
;
_new
->
next
=
next
;
_new
->
prev
=
prev
;
prev
->
next
=
_new
;
}
static
inline
void
fc_list_del
(
struct
fc_list_head
*
old
)
{
old
->
prev
->
next
=
old
->
next
;
old
->
next
->
prev
=
old
->
prev
;
old
->
next
=
(
struct
fc_list_head
*
)
0xbabebabe
;
old
->
prev
=
(
struct
fc_list_head
*
)
0xcafecafe
;
}
static
inline
void
fc_list_del_init
(
struct
fc_list_head
*
old
)
{
old
->
prev
->
next
=
old
->
next
;
old
->
next
->
prev
=
old
->
prev
;
old
->
next
=
old
;
old
->
prev
=
old
;
}
static
inline
void
fc_list_move
(
struct
fc_list_head
*
list
,
struct
fc_list_head
*
head
)
{
list
->
prev
->
next
=
list
->
next
;
list
->
next
->
prev
=
list
->
prev
;
fc_list_add
(
list
,
head
);
}
static
inline
void
fc_list_move_tail
(
struct
fc_list_head
*
list
,
struct
fc_list_head
*
head
)
{
list
->
prev
->
next
=
list
->
next
;
list
->
next
->
prev
=
list
->
prev
;
fc_list_add_tail
(
list
,
head
);
}
static
inline
int
fc_list_empty
(
struct
fc_list_head
*
head
)
{
return
(
head
->
next
==
head
);
}
static
inline
void
__fc_list_splice
(
struct
fc_list_head
*
list
,
struct
fc_list_head
*
head
)
{
(
list
->
prev
)
->
next
=
(
head
->
next
);
(
head
->
next
)
->
prev
=
(
list
->
prev
);
(
head
)
->
next
=
(
list
->
next
);
(
list
->
next
)
->
prev
=
(
head
);
}
static
inline
void
fc_list_splice
(
struct
fc_list_head
*
list
,
struct
fc_list_head
*
head
)
{
if
(
fc_list_empty
(
list
))
return
;
__fc_list_splice
(
list
,
head
);
}
static
inline
void
fc_list_splice_init
(
struct
fc_list_head
*
list
,
struct
fc_list_head
*
head
)
{
if
(
fc_list_empty
(
list
))
return
;
__fc_list_splice
(
list
,
head
);
FC_INIT_LIST_HEAD
(
list
);
}
static
inline
int
fc_list_is_last
(
const
struct
fc_list_head
*
list
,
const
struct
fc_list_head
*
head
)
{
return
list
->
next
==
head
;
}
static
inline
int
fc_list_count
(
struct
fc_list_head
*
head
)
{
struct
fc_list_head
*
pos
;
int
count
;
count
=
0
;
for
(
pos
=
head
->
next
;
pos
!=
head
;
pos
=
pos
->
next
)
{
++
count
;
}
return
count
;
}
#define fc_list_entry(ptr, type, member) \
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
#define fc_list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); pos = pos->next)
#define fc_list_for_each_entry(pos, head, member) \
for (pos = fc_list_entry((head)->next, typeof(*pos), member); \
&pos->member != (head); \
pos = fc_list_entry(pos->member.next, typeof(*pos), member))
#define fc_list_for_each_entry_safe(pos, n, head, member) \
for (pos = fc_list_entry((head)->next, typeof(*pos), member), \
n = fc_list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = fc_list_entry(n->member.next, typeof(*n), member))
#define fc_list_for_each_prev(pos, head) \
for (pos = (head)->prev; pos != (head); pos = pos->prev)
#ifdef __cplusplus
}
#endif
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录