xt-sdk 文档 v1.0.3
xt-sdk 嵌入式 SDK API 参考
载入中...
搜索中...
未找到
xt_list(链表)

XTINY 双向链表与单向链表操作接口 更多...

结构体

struct  xt_list_node
struct  xt_slist_node

宏定义

#define xt_container_of(ptr, type, member)
#define XT_LIST_OBJECT_INIT(object)
 initialize a list object
#define xt_list_entry(node, type, member)
 get the struct for this entry
#define xt_list_for_each(pos, head)
#define xt_list_for_each_safe(pos, n, head)
#define xt_list_for_each_entry(pos, head, member)
#define xt_list_for_each_entry_safe(pos, n, head, member)
#define xt_list_first_entry(ptr, type, member)
#define XT_SLIST_OBJECT_INIT(object)
#define xt_slist_entry(node, type, member)
 get the struct for this single list node
#define xt_slist_for_each(pos, head)
#define xt_slist_for_each_entry(pos, head, member)
#define xt_slist_first_entry(ptr, type, member)
#define xt_slist_tail_entry(ptr, type, member)

函数

static void xt_list_init (struct xt_list_node *l)
 initialize a list
static void xt_list_insert_after (struct xt_list_node *l, struct xt_list_node *n)
 insert a node after a list
static void xt_list_insert_before (struct xt_list_node *l, struct xt_list_node *n)
 insert a node before a list
static void xt_list_remove (struct xt_list_node *n)
 remove node from list.
static int xt_list_isempty (const struct xt_list_node *l)
 tests whether a list is empty
static unsigned int xt_list_len (const struct xt_list_node *l)
 get the list length
static void xt_slist_init (struct xt_slist_node *l)
 initialize a single list
static void xt_slist_append (struct xt_slist_node *l, struct xt_slist_node *n)
static void xt_slist_insert (struct xt_slist_node *l, struct xt_slist_node *n)
static unsigned int xt_slist_len (const struct xt_slist_node *l)
static struct xt_slist_node * xt_slist_remove (struct xt_slist_node *l, struct xt_slist_node *n)
static struct xt_slist_node * xt_slist_first (struct xt_slist_node *l)
static struct xt_slist_node * xt_slist_tail (struct xt_slist_node *l)
static struct xt_slist_node * xt_slist_next (struct xt_slist_node *n)
static int xt_slist_isempty (struct xt_slist_node *l)

详细描述

XTINY 双向链表与单向链表操作接口

宏定义说明

◆ xt_container_of

#define xt_container_of ( ptr,
type,
member )
值:
((type *)((char *)(ptr) - (uintptr_t)(&((type *)0)->member)))

xt_container_of - return the member address of ptr, if the type of ptr is the struct type.

在文件 xt_list.h 第 49 行定义.

◆ xt_list_entry

#define xt_list_entry ( node,
type,
member )
值:
xt_container_of(node, type, member)
#define xt_container_of(ptr, type, member)

get the struct for this entry

参数
nodethe entry point
typethe type of structure
memberthe name of list in structure

在文件 xt_list.h 第 140 行定义.

◆ xt_list_first_entry

#define xt_list_first_entry ( ptr,
type,
member )
值:
xt_list_entry((ptr)->next, type, member)
#define xt_list_entry(node, type, member)
get the struct for this entry

xt_list_first_entry - get the first element from a list @ptr: the list head to take the element from. @type: the type of the struct this is embedded in. @member: the name of the list_struct within the struct.

Note, that list is expected to be not empty.

在文件 xt_list.h 第 193 行定义.

◆ xt_list_for_each

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

xt_list_for_each - iterate over a list @pos: the struct xt_list_node * to use as a loop cursor. @head: the head for your list.

在文件 xt_list.h 第 148 行定义.

◆ xt_list_for_each_entry

#define xt_list_for_each_entry ( pos,
head,
member )
值:
for (pos = xt_list_entry((head)->next, typeof(*pos), member); \
&pos->member != (head); \
pos = xt_list_entry(pos->member.next, typeof(*pos), member))

xt_list_for_each_entry - iterate over list of given type @pos: the type * to use as a loop cursor. @head: the head for your list. @member: the name of the list_struct within the struct.

在文件 xt_list.h 第 167 行定义.

◆ xt_list_for_each_entry_safe

#define xt_list_for_each_entry_safe ( pos,
n,
head,
member )
值:
for (pos = xt_list_entry((head)->next, typeof(*pos), member), \
n = xt_list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = xt_list_entry(n->member.next, typeof(*n), member))

xt_list_for_each_entry_safe - iterate over list of given type safe against removal of list entry @pos: the type * to use as a loop cursor.
: another type * to use as temporary storage @head: the head for your list. @member: the name of the list_struct within the struct.

在文件 xt_list.h 第 179 行定义.

◆ xt_list_for_each_safe

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

xt_list_for_each_safe - iterate over a list safe against removal of list entry @pos: the struct xt_list_node * to use as a loop cursor.
: another struct xt_list_node * to use as temporary storage @head: the head for your list.

在文件 xt_list.h 第 157 行定义.

◆ XT_LIST_OBJECT_INIT

#define XT_LIST_OBJECT_INIT ( object)
值:
{ &(object), &(object) }

initialize a list object

在文件 xt_list.h 第 55 行定义.

◆ xt_slist_entry

#define xt_slist_entry ( node,
type,
member )
值:
xt_container_of(node, type, member)

get the struct for this single list node

参数
nodethe entry point
typethe type of structure
memberthe name of list in structure

在文件 xt_list.h 第 286 行定义.

◆ xt_slist_first_entry

#define xt_slist_first_entry ( ptr,
type,
member )
值:
xt_slist_entry((ptr)->next, type, member)
#define xt_slist_entry(node, type, member)
get the struct for this single list node

xt_slist_first_entry - get the first element from a slist @ptr: the slist head to take the element from. @type: the type of the struct this is embedded in. @member: the name of the slist_struct within the struct.

Note, that slist is expected to be not empty.

在文件 xt_list.h 第 316 行定义.

◆ xt_slist_for_each

#define xt_slist_for_each ( pos,
head )
值:
for (pos = (head)->next; pos != NULL; pos = pos->next)

xt_slist_for_each - iterate over a single list @pos: the struct xt_slist_node * to use as a loop cursor. @head: the head for your single list.

在文件 xt_list.h 第 294 行定义.

◆ xt_slist_for_each_entry

#define xt_slist_for_each_entry ( pos,
head,
member )
值:
for (pos = xt_slist_entry((head)->next, typeof(*pos), member); \
&pos->member != (NULL); \
pos = xt_slist_entry(pos->member.next, typeof(*pos), member))

xt_slist_for_each_entry - iterate over single list of given type @pos: the type * to use as a loop cursor. @head: the head for your single list. @member: the name of the list_struct within the struct.

在文件 xt_list.h 第 303 行定义.

◆ XT_SLIST_OBJECT_INIT

#define XT_SLIST_OBJECT_INIT ( object)
值:
{ NULL }

在文件 xt_list.h 第 196 行定义.

◆ xt_slist_tail_entry

#define xt_slist_tail_entry ( ptr,
type,
member )
值:
xt_slist_entry(xt_slist_tail(ptr), type, member)
static struct xt_slist_node * xt_slist_tail(struct xt_slist_node *l)

xt_slist_tail_entry - get the tail element from a slist @ptr: the slist head to take the element from. @type: the type of the struct this is embedded in. @member: the name of the slist_struct within the struct.

Note, that slist is expected to be not empty.

在文件 xt_list.h 第 327 行定义.

函数说明

◆ xt_list_init()

void xt_list_init ( struct xt_list_node * l)
inlinestatic

initialize a list

参数
llist to be initialized

在文件 xt_list.h 第 62 行定义.

◆ xt_list_insert_after()

void xt_list_insert_after ( struct xt_list_node * l,
struct xt_list_node * n )
inlinestatic

insert a node after a list

参数
llist to insert it
nnew node to be inserted

在文件 xt_list.h 第 73 行定义.

◆ xt_list_insert_before()

void xt_list_insert_before ( struct xt_list_node * l,
struct xt_list_node * n )
inlinestatic

insert a node before a list

参数
nnew node to be inserted
llist to insert it

在文件 xt_list.h 第 88 行定义.

◆ xt_list_isempty()

int xt_list_isempty ( const struct xt_list_node * l)
inlinestatic

tests whether a list is empty

参数
lthe list to test.

在文件 xt_list.h 第 113 行定义.

◆ xt_list_len()

unsigned int xt_list_len ( const struct xt_list_node * l)
inlinestatic

get the list length

参数
lthe list to get.

在文件 xt_list.h 第 122 行定义.

◆ xt_list_remove()

void xt_list_remove ( struct xt_list_node * n)
inlinestatic

remove node from list.

参数
nthe node to remove from the list.

在文件 xt_list.h 第 101 行定义.

◆ xt_slist_append()

void xt_slist_append ( struct xt_slist_node * l,
struct xt_slist_node * n )
inlinestatic

在文件 xt_list.h 第 208 行定义.

◆ xt_slist_first()

struct xt_slist_node * xt_slist_first ( struct xt_slist_node * l)
inlinestatic

在文件 xt_list.h 第 256 行定义.

◆ xt_slist_init()

void xt_slist_init ( struct xt_slist_node * l)
inlinestatic

initialize a single list

参数
lthe single list to be initialized

在文件 xt_list.h 第 203 行定义.

◆ xt_slist_insert()

void xt_slist_insert ( struct xt_slist_node * l,
struct xt_slist_node * n )
inlinestatic

在文件 xt_list.h 第 222 行定义.

◆ xt_slist_isempty()

int xt_slist_isempty ( struct xt_slist_node * l)
inlinestatic

在文件 xt_list.h 第 275 行定义.

◆ xt_slist_len()

unsigned int xt_slist_len ( const struct xt_slist_node * l)
inlinestatic

在文件 xt_list.h 第 228 行定义.

◆ xt_slist_next()

struct xt_slist_node * xt_slist_next ( struct xt_slist_node * n)
inlinestatic

在文件 xt_list.h 第 270 行定义.

◆ xt_slist_remove()

struct xt_slist_node * xt_slist_remove ( struct xt_slist_node * l,
struct xt_slist_node * n )
inlinestatic

在文件 xt_list.h 第 240 行定义.

◆ xt_slist_tail()

struct xt_slist_node * xt_slist_tail ( struct xt_slist_node * l)
inlinestatic

在文件 xt_list.h 第 261 行定义.