Lines Matching refs:list

17  * @defgroup utils_list Doubly linked list

46 * This API is used to initialize a doubly linked list.
52 * @param list [IN] Node in a doubly linked list.
59 static inline void UtilsListInit(UTILS_DL_LIST *list)
61 list->pstNext = list;
62 list->pstPrev = list;
78 * @param object [IN] Node in the doubly linked list.
89 * @brief Node is the end of the list.
93 * <li>This API is used to test node is the end of the list.</li>
100 * @param object [IN] Node in the doubly linked list.
107 #define UTILS_DL_LIST_IS_END(list, node) ((list) == (node) ? TRUE : FALSE)
111 * @brief Node is on the list.
115 * <li>This API is used to test node is on the list.</li>
122 * @param object [IN] Node in the doubly linked list.
144 * @param object [IN] Node in the doubly linked list.
155 * @brief Insert a new node to a doubly linked list.
158 * This API is used to insert a new node to a doubly linked list.
164 * @param list [IN] Doubly linked list where the new node is inserted.
172 static inline void UtilsListAdd(UTILS_DL_LIST *list, UTILS_DL_LIST *node)
174 node->pstNext = list->pstNext;
175 node->pstPrev = list;
176 list->pstNext->pstPrev = node;
177 list->pstNext = node;
182 * @brief Insert a node to the tail of a doubly linked list.
185 * This API is used to insert a new node to the tail of a doubly linked list.
191 * @param list [IN] Doubly linked list where the new node is inserted.
199 static inline void UtilsListTailInsert(UTILS_DL_LIST *list, UTILS_DL_LIST *node)
201 UtilsListAdd(list->pstPrev, node);
206 * @brief Insert a node to the head of a doubly linked list.
209 * This API is used to insert a new node to the head of a doubly linked list.
215 * @param list [IN] Doubly linked list where the new node is inserted.
223 static inline void UtilsListHeadInsert(UTILS_DL_LIST *list, UTILS_DL_LIST *node)
225 UtilsListAdd(list, node);
233 * <li>This API is used to delete a specified node from a doubly linked list.</li>
257 * @brief Identify whether a specified doubly linked list is empty.
261 * <li>This API is used to return whether a doubly linked list is empty.</li>
268 * @param list [IN] Doubly linked list.
270 * @retval TRUE The doubly linked list is empty.
271 * @retval FALSE The doubly linked list is not empty.
276 static inline bool UtilsListEmpty(UTILS_DL_LIST *list)
278 return (bool)(list->pstNext == list);
283 * @brief Insert a new list to a doubly linked list.
286 * This API is used to insert a new list to a doubly linked list.
292 * @param oldList [IN] Doubly linked list where the new list is inserted.
293 * @param newList [IN] New list to be inserted.
315 * @brief Insert a doubly list to the tail of a doubly linked list.
318 * This API is used to insert a new doubly list to the tail of a doubly linked list.
324 * @param oldList [IN] Doubly linked list where the new list is inserted.
325 * @param newList [IN] New list to be inserted.
339 * @brief Insert a doubly list to the head of a doubly linked list.
342 * This API is used to insert a new doubly list to the head of a doubly linked list.
348 * @param oldList [IN] Doubly linked list where the new list is inserted.
349 * @param newList [IN] New list to be inserted.
386 * @brief Obtain the pointer to a doubly linked list in a structure.
389 * This API is used to obtain the pointer to a doubly linked list in a structure.
396 * @param member [IN] Member name of the doubly linked list in the structure.
398 * @retval Pointer to the doubly linked list in the structure.
407 * @brief Obtain the pointer to a structure that contains a doubly linked list.
410 * This API is used to obtain the pointer to a structure that contains a doubly linked list.
421 * @param member [IN] Member name of the doubly linked list in the structure.
423 * @retval Pointer to the structure that contains the doubly linked list.
433 * @brief Iterate over a doubly linked list of given type.
436 * This API is used to iterate over a doubly linked list of given type.
442 * @param item [IN] Pointer to the structure that contains the doubly linked list that is to be traversed.
443 * @param list [IN] Pointer to the doubly linked list to be traversed.
445 * @param member [IN] Member name of the doubly linked list in the structure.
452 #define UTILS_DL_LIST_FOR_EACH_ENTRY(item, list, type, member) \
453 for (item = UTILS_DL_LIST_ENTRY((list)->pstNext, type, member); \
454 &(item)->member != (list); \
459 * @brief iterate over a doubly linked list safe against removal of list entry.
462 * This API is used to iterate over a doubly linked list safe against removal of list entry.
468 * @param item [IN] Pointer to the structure that contains the doubly linked list that is to be traversed.
470 * @param list [IN] Pointer to the doubly linked list to be traversed.
472 * @param member [IN] Member name of the doubly linked list in the structure.
479 #define UTILS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, next, list, type, member) \
480 for (item = UTILS_DL_LIST_ENTRY((list)->pstNext, type, member), \
482 &(item)->member != (list); \
487 * @brief Delete initialize a doubly linked list.
490 * This API is used to delete initialize a doubly linked list.
496 * @param list [IN] Doubly linked list.
503 static inline void UtilsListDelInit(UTILS_DL_LIST *list)
505 list->pstNext->pstPrev = list->pstPrev;
506 list->pstPrev->pstNext = list->pstNext;
507 UtilsListInit(list);
512 * @brief iterate over a doubly linked list.
515 * This API is used to iterate over a doubly linked list.
521 * @param item [IN] Pointer to the structure that contains the doubly linked list that is to be traversed.
522 * @param list [IN] Pointer to the doubly linked list to be traversed.
529 #define UTILS_DL_LIST_FOR_EACH(item, list) \
530 for (item = (list)->pstNext; \
531 (item) != (list); \
536 * @brief Iterate over a doubly linked list safe against removal of list entry.
539 * This API is used to iterate over a doubly linked list safe against removal of list entry.
545 * @param item [IN] Pointer to the structure that contains the doubly linked list that is to be traversed.
547 * @param list [IN] Pointer to the doubly linked list to be traversed.
554 #define UTILS_DL_LIST_FOR_EACH_SAFE(item, next, list) \
555 for (item = (list)->pstNext, next = (item)->pstNext; \
556 (item) != (list); \
561 * @brief Initialize a double linked list.
564 * This API is used to initialize a double linked list.
570 * @param list [IN] Pointer to the doubly linked list to be traversed.
577 #define UTILS_DL_LIST_HEAD(list) UTILS_DL_LIST list = { &(list), &(list) }
579 #define UTILS_ListPeekHeadType(list, type, element) \
582 if ((list)->pstNext == list) { \
585 __t = UTILS_DL_LIST_ENTRY((list)->pstNext, type, element); \
590 #define UTILS_ListRemoveHeadType(list, type, element) \
593 if ((list)->pstNext == list) { \
596 __t = UTILS_DL_LIST_ENTRY((list)->pstNext, type, element); \
597 UtilsListDelete((list)->pstNext); \
602 #define UTILS_ListNextType(list, item, type, element) \
605 if ((item)->pstNext == list) { \