TuyaOS
结构体 | 宏定义 | 类型定义 | 函数
tuya_list.h 文件参考

tuya bidirection list module 更多...

#include "tuya_cloud_types.h"
tuya_list.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

结构体

struct  tuya_list_head
 bidirection list head 更多...
 

宏定义

#define DeleteNode(pDelNode, list_name)
 remove the object from the bidirection list 更多...
 
#define DeleteNodeAndFree(pDelNode, list_name)
 remove the object from bidirection list and free the memory 更多...
 
#define FREE_LIST(type, p, list_name)
 free all objects in the bidirection list 更多...
 
#define FreeNode(pDelNode)
 free the object in bidirection list 更多...
 
#define GetFirstNode(type, p, list_name, pGetNode)
 get the first object of the bidirection list 更多...
 
#define INIT_LIST_HEAD(ptr)
 bidirection list initialization 更多...
 
#define LIST_HEAD(name)   LIST_HEAD name = LIST_HEAD_INIT(name)
 
#define LIST_HEAD_INIT(name)   { &(name), &(name) }
 define and initialize bidirection list head
 
#define NEW_LIST_NODE(type, node)
 create a new bidirection list, will call malloc 更多...
 
#define tuya_list_entry(ptr, type, member)   ((type *)((char *)(ptr)-(size_t)(&((type *)0)->member)))
 cast the bidirection list node to object
 
#define tuya_list_for_each(pos, head)   for (pos = (head)->next; (pos != NULL) && (pos != (head)); pos = pos->next)
 traverse the bidirection list, cannot change the bidiretion list during traverse
 
#define tuya_list_for_each_safe(p, n, head)   for (p = (head)->next; n = p->next, p != (head); p = n)
 traverse the bidirection list, can change the bidiretion list during traverse
 

类型定义

typedef struct tuya_list_head LIST_HEAD
 bidirection list head
 
typedef struct tuya_list_headP_LIST_HEAD
 

函数

void tuya_list_add (const P_LIST_HEAD pNew, const P_LIST_HEAD pHead)
 add new list node into bidirection list 更多...
 
void tuya_list_add_tail (const P_LIST_HEAD pNew, const P_LIST_HEAD pHead)
 add new list node to the tail of the bidirection list 更多...
 
void tuya_list_del (const P_LIST_HEAD pEntry)
 remove a list node from bidirection list 更多...
 
void tuya_list_del_init (const P_LIST_HEAD pEntry)
 remove a list node from bidirection list and initialize it 更多...
 
INT_T tuya_list_empty (const P_LIST_HEAD pHead)
 check if the bidirection list is empty 更多...
 
void tuya_list_splice (const P_LIST_HEAD pList, const P_LIST_HEAD pHead)
 splice two dibrection list 更多...
 

详细描述

tuya bidirection list module

版本
1.0
日期
2019-10-30

宏定义说明

◆ DeleteNode

#define DeleteNode (   pDelNode,
  list_name 
)
值:
{\
tuya_list_del(&(pDelNode->list_name));\
}

remove the object from the bidirection list

◆ DeleteNodeAndFree

#define DeleteNodeAndFree (   pDelNode,
  list_name 
)
值:
{\
tuya_list_del(&(pDelNode->list_name));\
tal_free(pDelNode);\
}

remove the object from bidirection list and free the memory

注解
the pDelNode must be the object pointer

◆ FREE_LIST

#define FREE_LIST (   type,
  p,
  list_name 
)
值:
{\
type *posnode;\
while(!tuya_list_empty(&(p)->list_name)) {\
posnode = tuya_list_entry((&(p)->list_name)->next, type, list_name);\
tuya_list_del((&(p)->list_name)->next);\
tal_free(posnode);\
}\
}
INT_T tuya_list_empty(const P_LIST_HEAD pHead)
check if the bidirection list is empty
#define tuya_list_entry(ptr, type, member)
cast the bidirection list node to object
Definition: tuya_list.h:114

free all objects in the bidirection list

◆ FreeNode

#define FreeNode (   pDelNode)
值:
{\
tal_free(pDelNode);\
}

free the object in bidirection list

◆ GetFirstNode

#define GetFirstNode (   type,
  p,
  list_name,
  pGetNode 
)
值:
{\
pGetNode = NULL;\
while(!tuya_list_empty(&(p)->list_name)){\
pGetNode = tuya_list_entry((&(p)->list_name)->next, type, list_name);\
break;\
}\
}

get the first object of the bidirection list

◆ INIT_LIST_HEAD

#define INIT_LIST_HEAD (   ptr)
值:
do { \
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)

bidirection list initialization

◆ NEW_LIST_NODE

#define NEW_LIST_NODE (   type,
  node 
)
值:
{\
node = (type *)tal_malloc(sizeof(type));\
}
VOID_T * tal_malloc(SIZE_T size)
Alloc memory of system

create a new bidirection list, will call malloc

函数说明

◆ tuya_list_add()

void tuya_list_add ( const P_LIST_HEAD  pNew,
const P_LIST_HEAD  pHead 
)

add new list node into bidirection list

参数
[in]pNewthe new list node
[in]pHeadthe bidirection list
返回
VOID

◆ tuya_list_add_tail()

void tuya_list_add_tail ( const P_LIST_HEAD  pNew,
const P_LIST_HEAD  pHead 
)

add new list node to the tail of the bidirection list

参数
[in]pNewthe new list node
[in]pHeadthe bidirection list
返回
VOID

◆ tuya_list_del()

void tuya_list_del ( const P_LIST_HEAD  pEntry)

remove a list node from bidirection list

参数
[in]pEntrythe list node need to remove
返回
VOID

◆ tuya_list_del_init()

void tuya_list_del_init ( const P_LIST_HEAD  pEntry)

remove a list node from bidirection list and initialize it

参数
[in]pEntrythe list node need to remove and initialize
返回
VOID

◆ tuya_list_empty()

INT_T tuya_list_empty ( const P_LIST_HEAD  pHead)

check if the bidirection list is empty

参数
[in]pHeadthe bidirection list
返回
0 means empty, others means empty

◆ tuya_list_splice()

void tuya_list_splice ( const P_LIST_HEAD  pList,
const P_LIST_HEAD  pHead 
)

splice two dibrection list

参数
[in]pListthe bidirection list need to splice
[in]pHeadthe bidirection list
返回
VOID