XFusion API v1.3.0
载入中...
搜索中...
未找到

移除 gnu 特性的双向链表。 更多...

xf_list 的协作图:

结构体

struct  xf_list_head
 双向链表结构体. 更多...
 

宏定义

#define XF_LIST_POISON1   0x00100100
 
#define XF_LIST_POISON2   0x00200200
 
#define XF_LIST_HEAD_INIT(name)   { &(name), &(name) }
 静态定义时初始化链表。
 
#define XF_LIST_HEAD(name)    xf_list_t name = XF_LIST_HEAD_INIT(name)
 定义一个名叫 name 的链表, 且以 name 为链表头.
 
#define xf_list_entry(ptr, type, member)    xf_container_of(ptr, type, member)
 xf_list_entry - 获取节点的结构体.
 
#define xf_list_first_entry(ptr, type, member)    xf_list_entry((ptr)->next, type, member)
 xf_list_first_entry - 获取链表中的第一个元素.
 
#define xf_list_for_each(pos, head)    for ((pos) = (head)->next; (pos) != (head); (pos) = (pos)->next)
 xf_list_for_each - 迭代链表.
 
#define __xf_list_for_each(pos, head)    for ((pos) = (head)->next; (pos) != (head); (pos) = (pos)->next)
 __xf_list_for_each - 迭代链表.
 
#define xf_list_for_each_prev(pos, head)    for ((pos) = (head)->prev; (pos) != (head); (pos) = (pos)->prev)
 xf_list_for_each_prev - 反向迭代链表.
 
#define xf_list_for_each_safe(pos, n, head)
 xf_list_for_each_safe - 迭代链表的安全版本, 防止删除链表节点时可能出现的问题.
 
#define xf_list_for_each_prev_safe(pos, n, head)
 xf_list_for_each_prev_safe - 方向迭代链表的安全版本, 防止删除链表节点时可能出现的问题.
 
#define xf_list_for_each_entry(pos, head, type, member)
 list_for_each_entry - 迭代给定类型的链表。
 
#define xf_list_for_each_entry_reverse(pos, head, type, member)
 list_for_each_entry_reverse - 倒序迭代给定类型的链表。
 
#define xf_list_prepare_entry(pos, head, type, member)    ((pos) ? : xf_list_entry(head, type, member))
 list_prepare_entry - 准备一个 pos 条目以在 list_for_each_entry_continue() 中使用。
 
#define xf_list_for_each_entry_continue(pos, head, type, member)
 list_for_each_entry_continue - 继续迭代给定类型的链表。
 
#define xf_list_for_each_entry_continue_reverse(pos, head, type, member)
 list_for_each_entry_continue_reverse - 从给定点倒序迭代。
 
#define xf_list_for_each_entry_from(pos, head, type, member)
 list_for_each_entry_from - 从当前点开始迭代给定类型的链表。
 
#define xf_list_for_each_entry_safe(pos, n, head, type, member)
 list_for_each_entry_safe - 安全地迭代给定类型的链表,可删除链表节点。
 
#define xf_list_for_each_entry_safe_continue(pos, n, head, type, member)
 list_for_each_entry_safe_continue - 安全地继续迭代链表,可删除链表节点。
 
#define xf_list_for_each_entry_safe_from(pos, n, head, type, member)
 list_for_each_entry_safe_from - 安全地从当前点迭代链表,可删除链表节点。
 
#define xf_list_for_each_entry_safe_reverse(pos, n, head, type, member)
 list_for_each_entry_safe_reverse - 安全地倒序迭代链表,可删除链表节点。
 
#define xf_list_safe_reset_next(pos, n, type, member)    (n) = xf_list_entry((pos)->member.next, type, member)
 list_safe_reset_next - 重置过时的 list_for_each_entry_safe 循环。
 

类型定义

typedef struct xf_list_head xf_list_t
 

函数

static void xf_list_init (xf_list_t *list)
 动态初始化链表.
 
static void __xf_list_add (xf_list_t *new_node, xf_list_t *prev, xf_list_t *next)
 在两个已知的连续节点之间插入一个 new_node 节点.
 
static void xf_list_add (xf_list_t *new_node, xf_list_t *head)
 xf_list_add - 在指定节点之后添加一个 new_node.
 
static void xf_list_add_tail (xf_list_t *new_node, xf_list_t *head)
 xf_list_add_tail - 在指定节点之前添加一个 new_node.
 
static void __xf_list_del (xf_list_t *prev, xf_list_t *next)
 删除链表节点(list entry), 使前一个/后一个节点相互指向.
 
static void __xf_list_del_entry (xf_list_t *entry)
 
static void xf_list_del (xf_list_t *entry)
 xf_list_del - 从链表中删除节点.
 
static void xf_list_replace (xf_list_t *old, xf_list_t *new_node)
 xf_list_replace - 用 new_node 替换旧节点.
 
static void xf_list_replace_init (xf_list_t *old, xf_list_t *new_node)
 xf_list_replace_init - 用 new_node 替换旧节点, 并重新初始化旧节点.
 
static void xf_list_del_init (xf_list_t *entry)
 xf_list_del_init - 从链表中删除节点, 并重新初始化.
 
static void xf_list_move (xf_list_t *list, xf_list_t *head)
 xf_list_move - 从一个链表中删除指定节点, 并添加为另一个链表的头节点。.
 
static void xf_list_move_tail (xf_list_t *list, xf_list_t *head)
 xf_list_move_tail - 从一个链表中删除指定节点, 并添加为另一个链表的尾节点.
 
static int xf_list_is_last (const xf_list_t *list, const xf_list_t *head)
 xf_list_is_last - 测试 list 是否是链表 head 中的最后一个节点.
 
static int xf_list_empty (const xf_list_t *head)
 xf_list_empty - 测试链表是否为空.
 
static int xf_list_empty_careful (const xf_list_t *head)
 xf_list_empty_careful - 测试链表是否为空且未被修改.
 
static void xf_list_rotate_left (xf_list_t *head)
 xf_list_rotate_left - 将链表向左旋转.
 
static int xf_list_is_singular (const xf_list_t *head)
 xf_list_is_singular - 测试链表是否只有一个节点.
 
static void __xf_list_cut_position (xf_list_t *list, xf_list_t *head, xf_list_t *entry)
 
static void xf_list_cut_position (xf_list_t *list, xf_list_t *head, xf_list_t *entry)
 xf_list_cut_position - 将链表切成两部分.
 
static void __xf_list_splice (const xf_list_t *list, xf_list_t *prev, xf_list_t *next)
 
static void xf_list_splice (const xf_list_t *list, xf_list_t *head)
 xf_list_splice - 连接两个链表, 这是为栈设计的.
 
static void xf_list_splice_tail (xf_list_t *list, xf_list_t *head)
 xf_list_splice_tail - 连接两个链表, 每个链表都是一个队列
 
static void xf_list_splice_init (xf_list_t *list, xf_list_t *head)
 xf_list_splice_init - 连接两个链表并重新初始化空链表.
 
static void xf_list_splice_tail_init (xf_list_t *list, xf_list_t *head)
 xf_list_splice_tail_init - 连接两个链表并重新初始化空链表.
 

详细描述

移除 gnu 特性的双向链表。

宏定义说明

◆ XF_LIST_POISON1

#define XF_LIST_POISON1   0x00100100

在文件 xf_list.h53 行定义.

◆ XF_LIST_POISON2

#define XF_LIST_POISON2   0x00200200

在文件 xf_list.h56 行定义.

◆ XF_LIST_HEAD_INIT

#define XF_LIST_HEAD_INIT (   name)    { &(name), &(name) }

静态定义时初始化链表。

在文件 xf_list.h82 行定义.

◆ XF_LIST_HEAD

#define XF_LIST_HEAD (   name)     xf_list_t name = XF_LIST_HEAD_INIT(name)

定义一个名叫 name 的链表, 且以 name 为链表头.

在文件 xf_list.h87 行定义.

◆ xf_list_entry

#define xf_list_entry (   ptr,
  type,
  member 
)     xf_container_of(ptr, type, member)

xf_list_entry - 获取节点的结构体.

从包含链表节点的结构体中获得结构体指针.

参数
ptr指向成员的指针.
type包含 xf_list_t 的结构体类型.
member结构中成员 list_struct 的名称.
返回
结构体的地址.

在文件 xf_list.h595 行定义.

◆ xf_list_first_entry

#define xf_list_first_entry (   ptr,
  type,
  member 
)     xf_list_entry((ptr)->next, type, member)

xf_list_first_entry - 获取链表中的第一个元素.

请注意,该链表不应为空.

参数
ptr链表头.
type包含 xf_list_t 的结构体类型.
member结构中成员 list_struct 的名称.
返回
结构体的地址.

在文件 xf_list.h617 行定义.

◆ xf_list_for_each

#define xf_list_for_each (   pos,
  head 
)     for ((pos) = (head)->next; (pos) != (head); (pos) = (pos)->next)

xf_list_for_each - 迭代链表.

参数
pos迭代游标 &xf_list_t.
head链表头.

在文件 xf_list.h632 行定义.

◆ __xf_list_for_each

#define __xf_list_for_each (   pos,
  head 
)     for ((pos) = (head)->next; (pos) != (head); (pos) = (pos)->next)

__xf_list_for_each - 迭代链表.

此变体与 xf_list_for_each() 不再有区别。

参数
pos迭代游标 &xf_list_t.
head链表头.

在文件 xf_list.h652 行定义.

◆ xf_list_for_each_prev

#define xf_list_for_each_prev (   pos,
  head 
)     for ((pos) = (head)->prev; (pos) != (head); (pos) = (pos)->prev)

xf_list_for_each_prev - 反向迭代链表.

参数
pos迭代游标 &xf_list_t.
head链表头.

在文件 xf_list.h667 行定义.

◆ xf_list_for_each_safe

#define xf_list_for_each_safe (   pos,
  n,
  head 
)
值:
for ((pos) = (head)->next, (n) = (pos)->next; (pos) != (head); \
(pos) = (n), (n) = (pos)->next)

xf_list_for_each_safe - 迭代链表的安全版本, 防止删除链表节点时可能出现的问题.

参数
pos迭代游标 &xf_list_t.
n另一个 &xf_list_t 用于临时存储.
head链表头.

在文件 xf_list.h684 行定义.

◆ xf_list_for_each_prev_safe

#define xf_list_for_each_prev_safe (   pos,
  n,
  head 
)
值:
for ((pos) = (head)->prev, (n) = (pos)->prev; \
(pos) != (head); \
(pos) = (n), (n) = (pos)->prev)

xf_list_for_each_prev_safe - 方向迭代链表的安全版本, 防止删除链表节点时可能出现的问题.

参数
pos迭代游标 &xf_list_t.
n另一个 &xf_list_t 用于临时存储.
head链表头.

在文件 xf_list.h702 行定义.

◆ xf_list_for_each_entry

#define xf_list_for_each_entry (   pos,
  head,
  type,
  member 
)
值:
for ((pos) = xf_list_entry((head)->next, type, member); \
&(pos)->member != (head); \
(pos) = xf_list_entry((pos)->member.next, type, member))
#define xf_list_entry(ptr, type, member)
xf_list_entry - 获取节点的结构体.
Definition xf_list.h:595

list_for_each_entry - 迭代给定类型的链表。

注意
注意, 由于移除了 GUN 的 typeof, 以下带有 _entry 后缀的宏都必须显式写出包含链表的含有链表节点的结构体的类型。, 详情见 xf_container_of.

pos 和 n 的数据类型必须相同!

正序迭代含有链表节点的结构体的链表,并取得结构体对象指针。

参数
pos用作迭代游标的结构体指针(类型为参数 type 的指针)。
head链表的头节点。
type含有链表节点的结构体的类型。
member链表节点在结构体中的成员名。。

在文件 xf_list.h732 行定义.

◆ xf_list_for_each_entry_reverse

#define xf_list_for_each_entry_reverse (   pos,
  head,
  type,
  member 
)
值:
for ((pos) = xf_list_entry((head)->prev, type, member); \
&(pos)->member != (head); \
(pos) = xf_list_entry((pos)->member.prev, type, member))

list_for_each_entry_reverse - 倒序迭代给定类型的链表。

倒序迭代含有链表节点的结构体的链表,并取得结构体对象指针。

参数
pos用作迭代游标的结构体指针(类型为参数 type 的指针)。
head链表的头节点。
type含有链表节点的结构体的类型。
member链表节点在结构体中的成员名。

在文件 xf_list.h754 行定义.

◆ xf_list_prepare_entry

#define xf_list_prepare_entry (   pos,
  head,
  type,
  member 
)     ((pos) ? : xf_list_entry(head, type, member))

list_prepare_entry - 准备一个 pos 条目以在 list_for_each_entry_continue() 中使用。

xf_list_for_each_entry_continue() 调用之前,确保传入的 pos 有效。 如果 pos 不存在,则从头强制拓展一个 pos 参数。

参数
pos用作迭代游标的结构体指针(类型为参数 type 的指针)。
head链表的头节点。
type含有链表节点的结构体的类型。
member链表节点在结构体中的成员名。

在文件 xf_list.h779 行定义.

◆ xf_list_for_each_entry_continue

#define xf_list_for_each_entry_continue (   pos,
  head,
  type,
  member 
)
值:
for ((pos) = xf_list_entry((pos)->member.next, type, member); \
&(pos)->member != (head); \
(pos) = xf_list_entry((pos)->member.next, type, member))

list_for_each_entry_continue - 继续迭代给定类型的链表。

继续迭代给定类型的链表,在当前位置之后继续(迭代不包括当前节点)。

参数
pos用作迭代游标的结构体指针(类型为参数 type 的指针)。
head链表的头节点。
type含有链表节点的结构体的类型。
member链表节点在结构体中的成员名。

在文件 xf_list.h802 行定义.

◆ xf_list_for_each_entry_continue_reverse

#define xf_list_for_each_entry_continue_reverse (   pos,
  head,
  type,
  member 
)
值:
for ((pos) = xf_list_entry((pos)->member.prev, type, member); \
&(pos)->member != (head); \
(pos) = xf_list_entry((pos)->member.prev, type, member))

list_for_each_entry_continue_reverse - 从给定点倒序迭代。

迭代之前迭代过的链表(迭代不包括当前值且顺序相反)。

参数
pos用作迭代游标的结构体指针(类型为参数 type 的指针)。
head链表的头节点。
type含有链表节点的结构体的类型。
member链表节点在结构体中的成员名。

在文件 xf_list.h827 行定义.

◆ xf_list_for_each_entry_from

#define xf_list_for_each_entry_from (   pos,
  head,
  type,
  member 
)
值:
for (; &(pos)->member != (head); \
(pos) = xf_list_entry((pos)->member.next, type, member))

list_for_each_entry_from - 从当前点开始迭代给定类型的链表。

继续迭代给定类型的链表,从当前位置开始迭代(迭代包括当前值)。

参数
pos用作迭代游标的结构体指针(类型为参数 type 的指针)。
head链表的头节点。
type含有链表节点的结构体的类型。
member链表节点在结构体中的成员名。

在文件 xf_list.h851 行定义.

◆ xf_list_for_each_entry_safe

#define xf_list_for_each_entry_safe (   pos,
  n,
  head,
  type,
  member 
)
值:
for ((pos) = xf_list_entry((head)->next, type, member), \
(n) = xf_list_entry((pos)->member.next, type, member); \
&(pos)->member != (head); \
(pos) = (n), (n) = xf_list_entry(n->member.next, type, member))

list_for_each_entry_safe - 安全地迭代给定类型的链表,可删除链表节点。

迭代链表的安全版本,额外提供结构体指针 n 用于缓存下一个节点。

注解
在迭代的过程中需要删除链表节点时,使用该宏以确保链表后续能正确迭代。
参数
pos用作迭代游标的结构体指针(类型为参数 type 的指针)。
n用作迭代缓存的结构体指针(类型为参数 type 的指针)。
head链表的头节点。
type含有链表节点的结构体的类型。
member链表节点在结构体中的成员名。

在文件 xf_list.h876 行定义.

◆ xf_list_for_each_entry_safe_continue

#define xf_list_for_each_entry_safe_continue (   pos,
  n,
  head,
  type,
  member 
)
值:
for ((pos) = xf_list_entry((pos)->member.next, type, member), \
(n) = xf_list_entry((pos)->member.next, type, member); \
&(pos)->member != (head); \
(pos) = (n), (n) = xf_list_entry((n)->member.next, type, member))

list_for_each_entry_safe_continue - 安全地继续迭代链表,可删除链表节点。

从给定点继续迭代链表的安全版本(迭代不包括当前节点),额外提供结构体指针 n 用于缓存下一个节点。

注解
在迭代的过程中需要删除链表节点时,使用该宏以确保链表后续能正确迭代。
参数
pos用作迭代游标的结构体指针(类型为参数 type 的指针)。
n用作迭代缓存的结构体指针(类型为参数 type 的指针)。
head链表的头节点。
type含有链表节点的结构体的类型。
member链表节点在结构体中的成员名。

在文件 xf_list.h906 行定义.

◆ xf_list_for_each_entry_safe_from

#define xf_list_for_each_entry_safe_from (   pos,
  n,
  head,
  type,
  member 
)
值:
for ((n) = xf_list_entry((pos)->member.next, type, member); \
&(pos)->member != (head); \
(pos) = (n), (n) = xf_list_entry((n)->member.next, type, member))

list_for_each_entry_safe_from - 安全地从当前点迭代链表,可删除链表节点。

从给定点迭代链表的安全版本(迭代包括当前节点),额外提供结构体指针 n 用于缓存下一个节点。

注解
在迭代的过程中需要删除链表节点时,使用该宏以确保链表后续能正确迭代。
参数
pos用作迭代游标的结构体指针(类型为参数 type 的指针)。
n用作迭代缓存的结构体指针(类型为参数 type 的指针)。
head链表的头节点。
type含有链表节点的结构体的类型。
member链表节点在结构体中的成员名。

在文件 xf_list.h936 行定义.

◆ xf_list_for_each_entry_safe_reverse

#define xf_list_for_each_entry_safe_reverse (   pos,
  n,
  head,
  type,
  member 
)
值:
for ((pos) = xf_list_entry((head)->prev, type, member), \
(n) = xf_list_entry((pos)->member.prev, type, member); \
&(pos)->member != (head); \
(pos) = (n), (n) = xf_list_entry((n)->member.prev, type, member))

list_for_each_entry_safe_reverse - 安全地倒序迭代链表,可删除链表节点。

倒序迭代链表的安全版本,额外提供结构体指针 n 用于缓存下一个节点。

注解
在迭代的过程中需要删除链表节点时,使用该宏以确保链表后续能正确迭代。
参数
pos用作迭代游标的结构体指针(类型为参数 type 的指针)。
n用作迭代缓存的结构体指针(类型为参数 type 的指针)。
head链表的头节点。
type含有链表节点的结构体的类型。
member链表节点在结构体中的成员名。

在文件 xf_list.h965 行定义.

◆ xf_list_safe_reset_next

#define xf_list_safe_reset_next (   pos,
  n,
  type,
  member 
)     (n) = xf_list_entry((pos)->member.next, type, member)

list_safe_reset_next - 重置过时的 list_for_each_entry_safe 循环。

刷新用于缓存的节点 n(因为该节点可能过时)。

如果链表可能被并发修改(例如,锁在循环体中被删除), 那么 xf_list_safe_reset_next 通常使用起来不安全。 一个例外是,如果游标元素 (pos) 固定在链表中, 并且在重新获取锁定之后和完成循环体的当前迭代之前调用 xf_list_safe_reset_next。

参数
pos用作迭代游标的结构体指针(类型为参数 type 的指针)。
n用作迭代缓存的结构体指针(类型为参数 type 的指针)。
type含有链表节点的结构体的类型。
member链表节点在结构体中的成员名。

在文件 xf_list.h999 行定义.

类型定义说明

◆ xf_list_t

typedef struct xf_list_head xf_list_t

在文件 xf_list.h67 行定义.

函数说明

◆ xf_list_init()

static void xf_list_init ( xf_list_t list)
inlinestatic

动态初始化链表.

参数
list被初始化的链表节点.

在文件 xf_list.h97 行定义.

◆ __xf_list_add()

static void __xf_list_add ( xf_list_t new_node,
xf_list_t prev,
xf_list_t next 
)
inlinestatic

在两个已知的连续节点之间插入一个 new_node 节点.

注意
仅用于内部链表操作, 因为已经知道前一个/后一个节点!
参数
new_node
prev
next

在文件 xf_list.h119 行定义.

◆ xf_list_add()

static void xf_list_add ( xf_list_t new_node,
xf_list_t head 
)
inlinestatic

xf_list_add - 在指定节点之后添加一个 new_node.

这对于实现栈(stacks)很有好处.

参数
new_node要添加的 new_node.
head需要添加 new_node 到其后面的节点, 也就是 new_node 将添加到 head 节点后面.

在文件 xf_list.h145 行定义.

◆ xf_list_add_tail()

static void xf_list_add_tail ( xf_list_t new_node,
xf_list_t head 
)
inlinestatic

xf_list_add_tail - 在指定节点之前添加一个 new_node.

这对于实现队列(queues)很有用.

参数
new_node要添加的 new_node.
head需要添加 new_node 到其前面的节点, 也就是 new_node 将添加到 head 节点前面.

在文件 xf_list.h168 行定义.

◆ __xf_list_del()

static void __xf_list_del ( xf_list_t prev,
xf_list_t next 
)
inlinestatic

删除链表节点(list entry), 使前一个/后一个节点相互指向.

注意
仅用于内部链表操作, 因为已经知道前一个/后一个节点!
参数
prev
next

在文件 xf_list.h188 行定义.

◆ __xf_list_del_entry()

static void __xf_list_del_entry ( xf_list_t entry)
inlinestatic

在文件 xf_list.h201 行定义.

◆ xf_list_del()

static void xf_list_del ( xf_list_t entry)
inlinestatic

xf_list_del - 从链表中删除节点.

参数
entry要从链表中删除的元素.
注解
之后, 节点上的 xf_list_empty() 不会返回 true, 此时节点处于未定义状态.

在文件 xf_list.h213 行定义.

◆ xf_list_replace()

static void xf_list_replace ( xf_list_t old,
xf_list_t new_node 
)
inlinestatic

xf_list_replace - 用 new_node 替换旧节点.

如果 old 为空, 则会被覆盖. (If old was empty, it will be overwritten.)

参数
old被替换的节点.
new_node要插入的 new_node 节点.

在文件 xf_list.h236 行定义.

◆ xf_list_replace_init()

static void xf_list_replace_init ( xf_list_t old,
xf_list_t new_node 
)
inlinestatic

xf_list_replace_init - 用 new_node 替换旧节点, 并重新初始化旧节点.

参数
old被替换的节点.
new_node要插入的 new_node 节点.

在文件 xf_list.h250 行定义.

◆ xf_list_del_init()

static void xf_list_del_init ( xf_list_t entry)
inlinestatic

xf_list_del_init - 从链表中删除节点, 并重新初始化.

参数
entry要从链表中删除的节点.

在文件 xf_list.h266 行定义.

◆ xf_list_move()

static void xf_list_move ( xf_list_t list,
xf_list_t head 
)
inlinestatic

xf_list_move - 从一个链表中删除指定节点, 并添加为另一个链表的头节点。.

参数
list要移动的节点.
headlist 节点进入之前的头节点, 也就是 list 进入之后, head 变为 list 后一个节点.

在文件 xf_list.h285 行定义.

◆ xf_list_move_tail()

static void xf_list_move_tail ( xf_list_t list,
xf_list_t head 
)
inlinestatic

xf_list_move_tail - 从一个链表中删除指定节点, 并添加为另一个链表的尾节点.

参数
list要移动的节点.
headlist 节点进入之后的头节点.

在文件 xf_list.h303 行定义.

◆ xf_list_is_last()

static int xf_list_is_last ( const xf_list_t list,
const xf_list_t head 
)
inlinestatic

xf_list_is_last - 测试 list 是否是链表 head 中的最后一个节点.

参数
list要测试的节点.
head链表头.
返回
int
  • 1 是最后一个节点
  • 0 不是最后一个节点

在文件 xf_list.h324 行定义.

◆ xf_list_empty()

static int xf_list_empty ( const xf_list_t head)
inlinestatic

xf_list_empty - 测试链表是否为空.

参数
head要测试的链表头节点.
返回
int
  • 1 空表
  • 0 非空表

在文件 xf_list.h342 行定义.

◆ xf_list_empty_careful()

static int xf_list_empty_careful ( const xf_list_t head)
inlinestatic

xf_list_empty_careful - 测试链表是否为空且未被修改.

测试链表是否为空并检查是否没有其他 CPU 正在修改任一成员(下一个或上一个).

注意
不同步地使用 xf_list_empty_careful(), 只有在 xf_list_del_init() 是链表节点唯一可能发生的活动时才是安全的. 例如, 如果另一个 CPU 可以重新添加 xf_list_add(), 则不能使用该函数.
参数
head要测试的链表头节点.
返回
int
  • 1 为空且未被修改
  • 0 不为空或正在被修改

在文件 xf_list.h375 行定义.

◆ xf_list_rotate_left()

static void xf_list_rotate_left ( xf_list_t head)
inlinestatic

xf_list_rotate_left - 将链表向左旋转.

参数
head链表头节点.

在文件 xf_list.h391 行定义.

◆ xf_list_is_singular()

static int xf_list_is_singular ( const xf_list_t head)
inlinestatic

xf_list_is_singular - 测试链表是否只有一个节点.

参数
head链表头节点.
返回
int
  • 1 只有一个节点
  • 0 不只有一个节点

在文件 xf_list.h414 行定义.

◆ __xf_list_cut_position()

static void __xf_list_cut_position ( xf_list_t list,
xf_list_t head,
xf_list_t entry 
)
inlinestatic

在文件 xf_list.h419 行定义.

◆ xf_list_cut_position()

static void xf_list_cut_position ( xf_list_t list,
xf_list_t head,
xf_list_t entry 
)
inlinestatic

xf_list_cut_position - 将链表切成两部分.

该辅助函数将 head 的初始部分(包括 entry 在内)从 head 移至 list. 你应该在 entry 中传递一个你知道在 head 中的元素. list 应该是一个空链表, 或者是一个你不希望丢失数据的链表.

参数
list一个 new_node 链表, 用于添加所有已删除的节点.
head包含节点的链表
entryhead 中的一个节点, 可以是 head 本身, 如果这样, 则不会删除该链表.

在文件 xf_list.h457 行定义.

◆ __xf_list_splice()

static void __xf_list_splice ( const xf_list_t list,
xf_list_t prev,
xf_list_t next 
)
inlinestatic

在文件 xf_list.h474 行定义.

◆ xf_list_splice()

static void xf_list_splice ( const xf_list_t list,
xf_list_t head 
)
inlinestatic

xf_list_splice - 连接两个链表, 这是为栈设计的.

参数
list要添加的 new_node 链表.
head将其添加到第一个链表中的位置.

在文件 xf_list.h499 行定义.

◆ xf_list_splice_tail()

static void xf_list_splice_tail ( xf_list_t list,
xf_list_t head 
)
inlinestatic

xf_list_splice_tail - 连接两个链表, 每个链表都是一个队列

参数
list要添加的 new_node 链表.
head将其添加到第一个链表中的位置.

在文件 xf_list.h519 行定义.

◆ xf_list_splice_init()

static void xf_list_splice_init ( xf_list_t list,
xf_list_t head 
)
inlinestatic

xf_list_splice_init - 连接两个链表并重新初始化空链表.

list 处的链表被重新初始化.

参数
list要添加的 new_node 链表.
head将其添加到第一个链表中的位置.

在文件 xf_list.h542 行定义.

◆ xf_list_splice_tail_init()

static void xf_list_splice_tail_init ( xf_list_t list,
xf_list_t head 
)
inlinestatic

xf_list_splice_tail_init - 连接两个链表并重新初始化空链表.

每个链表都是一个队列. list 处的链表被重新初始化.

参数
list要添加的 new_node 链表.
head将其添加到第一个链表中的位置.

在文件 xf_list.h568 行定义.