mirror of
https://github.com/labwc/labwc.git
synced 2025-11-05 13:29:58 -05:00
common: add wl_list_append()
This commit is contained in:
parent
cc5d364f0f
commit
042af48925
1 changed files with 19 additions and 0 deletions
19
include/common/list.h
Normal file
19
include/common/list.h
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#include <wayland-server-core.h>
|
||||
|
||||
/**
|
||||
* wl_list_append() - add a new element to the end of a list
|
||||
* @list: list head to add it before
|
||||
* @elm: new element to be added (link of the containing struct to be precise)
|
||||
*
|
||||
* Note: In labwc, most lists are queues where we want to add new elements to
|
||||
* the end of the list. As wl_list_insert() adds elements at the front of the
|
||||
* list (like a stack) - without this helper-function - we have to use
|
||||
* wl_list_insert(list.prev, element) which is verbose and not intuitive to
|
||||
* anyone new to this API.
|
||||
*/
|
||||
static inline void
|
||||
wl_list_append(struct wl_list *list, struct wl_list *elm)
|
||||
{
|
||||
wl_list_insert(list->prev, elm);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue