tuya sigle direciton list module
更多...
#include "tuya_cloud_types.h"
浏览源代码.
|
| #define | FREE_SLIST_SAFE(tpos, type, pos, n, list, member) |
| | traverse and free each object of the sigle list 更多...
|
| |
| #define | INIT_SLIST_HEAD(ptr) |
| | sigle list head initialization 更多...
|
| |
| #define | NEW_SLIST_NODE(type, node) |
| | new a sigle list head, will call Malloc 更多...
|
| |
|
#define | SLIST_ENTRY(ptr, type, member) CNTR_OF(ptr,type,member) |
| | cast the slist entry to special type
|
| |
| #define | SLIST_FOR_EACH(pos, list) |
| | traverse each node of the sigle list, cannot change the sigle list 更多...
|
| |
| #define | SLIST_FOR_EACH_ENTRY(tpos, type, pos, list, member) |
| | traverse each object of the sigle list, cannot change the sigle list 更多...
|
| |
| #define | SLIST_FOR_EACH_ENTRY_SAFE(tpos, type, pos, n, list, member) |
| | traverse each object of the sigle list, you can add or del the object during traverse 更多...
|
| |
| #define | SLIST_FOR_EACH_SAFE(pos, n, list) |
| | traverse each node of the sigle list, you can add or del the object during traverse 更多...
|
| |
|
#define | SLIST_HEAD(name) SLIST_HEAD name = {NULL} |
| | define a sigle list head and initialize to empty
|
| |
|
|
typedef struct slist_head | SLIST_HEAD |
| | sigle list head
|
| |
tuya sigle direciton list module
- 版本
- 1.0
- 日期
- 2019-10-30
- 版权所有
- Copyright 2021-2025 Tuya Inc. All Rights Reserved.
◆ FREE_SLIST_SAFE
| #define FREE_SLIST_SAFE |
( |
|
tpos, |
|
|
|
type, |
|
|
|
pos, |
|
|
|
n, |
|
|
|
list, |
|
|
|
member |
|
) |
| |
值:{\
type *posnode; \
SLIST_FOR_EACH_ENTRY_SAFE(tpos, type, pos, n, list, member) { \
(list)->next = n; \
posnode = tpos; \
Free(posnode); \
} \
}
traverse and free each object of the sigle list
◆ INIT_SLIST_HEAD
| #define INIT_SLIST_HEAD |
( |
|
ptr | ) |
|
值: do { \
(ptr)->next = NULL; \
} while (0)
sigle list head initialization
◆ NEW_SLIST_NODE
| #define NEW_SLIST_NODE |
( |
|
type, |
|
|
|
node |
|
) |
| |
值:{\
node = (type *)
Malloc(
sizeof(type));\
}
#define Malloc(req_size)
malloc memory
Definition: tal_memory.h:25
new a sigle list head, will call Malloc
◆ SLIST_FOR_EACH
| #define SLIST_FOR_EACH |
( |
|
pos, |
|
|
|
list |
|
) |
| |
值: for (pos = (list)->next; pos ; \
pos = pos->next)
traverse each node of the sigle list, cannot change the sigle list
◆ SLIST_FOR_EACH_ENTRY
| #define SLIST_FOR_EACH_ENTRY |
( |
|
tpos, |
|
|
|
type, |
|
|
|
pos, |
|
|
|
list, |
|
|
|
member |
|
) |
| |
值: for (pos = (list)->next; \
pos = pos->next)
#define SLIST_ENTRY(ptr, type, member)
cast the slist entry to special type
Definition: tuya_slist.h:56
traverse each object of the sigle list, cannot change the sigle list
◆ SLIST_FOR_EACH_ENTRY_SAFE
| #define SLIST_FOR_EACH_ENTRY_SAFE |
( |
|
tpos, |
|
|
|
type, |
|
|
|
pos, |
|
|
|
n, |
|
|
|
list, |
|
|
|
member |
|
) |
| |
值: for (pos = (list)->next; \
pos && (n = pos->next, 1) && \
pos = n)
traverse each object of the sigle list, you can add or del the object during traverse
◆ SLIST_FOR_EACH_SAFE
| #define SLIST_FOR_EACH_SAFE |
( |
|
pos, |
|
|
|
n, |
|
|
|
list |
|
) |
| |
值: for (pos = (list)->next; pos && ({ n = pos->next; 1; }); \
pos = n)
traverse each node of the sigle list, you can add or del the object during traverse