Lines Matching full:list

9   * @defgroup single-linked-list_apis Single-linked list
12 * @brief Single-linked list implementation.
14 * Single-linked list implementation using inline macros/functions.
15 * This API is not thread safe, and thus if a list is used across threads,
38 /** Single-linked list node structure. */
48 /** Single-linked list structure. */
52 * @brief Provide the primitive to iterate on a list
64 * @param __sn A sys_snode_t pointer to peek each node of the list
70 * @brief Provide the primitive to iterate on a list, from a node in the list
79 * Like SYS_SLIST_FOR_EACH_NODE(), but __dn already contains a node in the list
86 * @param __sn A sys_snode_t pointer to peek each node of the list
93 * @brief Provide the primitive to safely iterate on a list
105 * @param __sn A sys_snode_t pointer to peek each node of the list
112 * @brief Provide the primitive to resolve the container of a list node
123 * @brief Provide the primitive to peek container of the list head
133 * @brief Provide the primitive to peek container of the list tail
152 * @brief Provide the primitive to iterate on a list under a container
162 * @param __cn A pointer to peek each entry of the list
169 * @brief Provide the primitive to safely iterate on a list under a container
179 * @param __cn A pointer to peek each entry of the list
190 * These are the only functions that do not treat the list/node pointers
195 * @brief Initialize a list
197 * @param list A pointer on the list to initialize
199 static inline void sys_slist_init(sys_slist_t *list) in sys_slist_init() argument
201 list->head = NULL; in sys_slist_init()
202 list->tail = NULL; in sys_slist_init()
206 * @brief Statically initialize a single-linked list
207 * @param ptr_to_list A pointer on the list to initialize
221 static inline void z_slist_head_set(sys_slist_t *list, sys_snode_t *node) in z_slist_head_set() argument
223 list->head = node; in z_slist_head_set()
226 static inline void z_slist_tail_set(sys_slist_t *list, sys_snode_t *node) in z_slist_tail_set() argument
228 list->tail = node; in z_slist_tail_set()
232 * @brief Peek the first node from the list
234 * @param list A point on the list to peek the first node from
236 * @return A pointer on the first node of the list (or NULL if none)
238 static inline sys_snode_t *sys_slist_peek_head(sys_slist_t *list) in sys_slist_peek_head() argument
240 return list->head; in sys_slist_peek_head()
244 * @brief Peek the last node from the list
246 * @param list A point on the list to peek the last node from
248 * @return A pointer on the last node of the list (or NULL if none)
250 static inline sys_snode_t *sys_slist_peek_tail(sys_slist_t *list) in sys_slist_peek_tail() argument
252 return list->tail; in sys_slist_peek_tail()
260 * @brief Test if the given list is empty
262 * @param list A pointer on the list to test
266 static inline bool sys_slist_is_empty(sys_slist_t *list);
295 * @brief Prepend a node to the given list
299 * @param list A pointer on the list to affect
302 static inline void sys_slist_prepend(sys_slist_t *list,
308 * @brief Append a node to the given list
312 * @param list A pointer on the list to affect
315 static inline void sys_slist_append(sys_slist_t *list,
321 * @brief Append a list to the given list
323 * Append a singly-linked, NULL-terminated list consisting of nodes containing
324 * the pointer to the next node as the first element of a node, to @a list.
329 * @param list A pointer on the list to affect
330 * @param head A pointer to the first element of the list to append
331 * @param tail A pointer to the last element of the list to append
333 static inline void sys_slist_append_list(sys_slist_t *list,
341 * When the operation is completed, the appending list is empty.
344 * @param list A pointer on the list to affect
345 * @param list_to_append A pointer to the list to append.
347 static inline void sys_slist_merge_slist(sys_slist_t *list,
353 * @brief Insert a node to the given list
357 * @param list A pointer on the list to affect
361 static inline void sys_slist_insert(sys_slist_t *list,
368 * @brief Fetch and remove the first node of the given list
370 * List must be known to be non-empty.
373 * @param list A pointer on the list to affect
375 * @return A pointer to the first node of the list
377 static inline sys_snode_t *sys_slist_get_not_empty(sys_slist_t *list);
382 * @brief Fetch and remove the first node of the given list
386 * @param list A pointer on the list to affect
388 * @return A pointer to the first node of the list (or NULL if empty)
390 static inline sys_snode_t *sys_slist_get(sys_slist_t *list);
399 * @param list A pointer on the list to affect
401 * (can be NULL, which means the node is the list's head)
404 static inline void sys_slist_remove(sys_slist_t *list,
411 * @brief Find and remove a node from a list
415 * @param list A pointer on the list to affect
416 * @param node A pointer on the node to remove from the list
420 static inline bool sys_slist_find_and_remove(sys_slist_t *list,
424 * @brief Find if a node is already linked in a singly linked list
428 * @param list A pointer to the list to check
429 * @param node A pointer to the node to search in the list
432 * @return true if node was found in the list, false otherwise
434 static inline bool sys_slist_find(sys_slist_t *list, sys_snode_t *node,
439 * @brief Compute the size of the given list in O(n) time
441 * @param list A pointer on the list
443 * @return an integer equal to the size of the list, or 0 if empty
445 static inline size_t sys_slist_len(sys_slist_t *list);