Manual Pages for Linux CentOS command on man wl_list
MyWebUniversity

Manual Pages for Linux CentOS command on man wl_list

wllist(3) Wayland wllist(3)

NAME

wllist -

Doubly-linked list. SYNOPSIS

#include Public Member Functions void wllistinit (struct wllist *list) void wllistinsert (struct wllist *list, struct wllist *elm) void wllistremove (struct wllist *elm) int wllistlength (const struct wllist *list) int wllistempty (const struct wllist *list) void wllistinsertlist (struct wllist *list, struct wllist *other) Data Fields struct wllist * prev struct wllist * next Related Functions (Note that these are not member functions.)

#define wllistforeach(pos, head, member)

#define wllistforeachsafe(pos, tmp, head, member)

#define wllistforeachreverse(pos, head, member)

#define wllistforeachreversesafe(pos, tmp, head, member) Detailed Description

Doubly-linked list. On its own, an instance of struct wllist represents the sentinel head

of a doubly-linked list, and must be initialized using wllistinit(). When empty, the list head's next and prev members point to the list head itself, otherwise next references the first element in the list, and prev refers to the last element in the list. Use the struct wllist type to represent both the list head and the links between elements within the list. Use wllistempty() to determine if the list is empty in O(1). All elements in the list must be of the same type. The element type must have a struct wllist member, often named link by convention.

Prior to insertion, there is no need to initialize an element's link - invoking wllistinit() on an individual list element's struct wllist member is unnecessary if the very next operation is wllistinsert(). However, a common idiom is to initialize an element's link prior to

removal - ensure safety by invoking wllistinit() before wllistremove(). Consider a list reference struct wllist foolist, an element type as struct element, and an element's link member as struct wllist link. The following code initializes a list and adds three elements to it. * struct wllist foolist; * * struct element { * int foo; * struct wllist link; * }; * struct element e1, e2, e3; * * wllistinit(&foolist); * wllistinsert(&foolist, &e1.link); // e1 is the first element * wllistinsert(&foolist, &e2.link); // e2 is now the first element * wllistinsert(&e2.link, &e3.link); // insert e3 after e2 * The list now looks like [e2, e3, e1]. The wllist API provides some iterator macros. For example, to iterate a list in ascending order: * struct element *e; * wllistforeach(e, foolist, link) { * dosomethingwithelement(e); * } * See the documentation of each iterator for details. See Also: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/linux/list.h Member Function Documentation int wllistempty (const struct wllist *list) Determines if the list is empty. Parameters: list List whose emptiness is to be determined Returns: 1 if empty, or 0 if not empty void wllistinit (struct wllist *list) Initializes the list. Parameters: list List to initialize void wllistinsert (struct wllist *list, struct wllist *elm) Inserts an element into the list, after the element represented by list. When list is a reference to the list itself (the head), set the containing struct of elm as the first element in the list. Note: If elm is already part of a list, inserting it again will lead to list corruption. Parameters: list List element after which the new element is inserted elm Link of the containing struct to insert into the list void wllistinsertlist (struct wllist *list, struct wllist *other) Inserts all of the elements of one list into another, after the element represented by list. Note: This leaves other in an invalid state. Parameters: list List element after which the other list elements will be inserted other List of elements to insert int wllistlength (const struct wllist *list) Determines the length of the list. Note: This is an O(n) operation. Parameters: list List whose length is to be determined Returns: Number of elements in the list void wllistremove (struct wllist *elm) Removes an element from the list. Note: This operation leaves elm in an invalid state. Parameters: elm Link of the containing struct to remove from the list Friends And Related Function Documentation

#define wllistforeach(pos, head, member) [related] Value:

for (pos = wlcontainerof((head)->next, pos, member); &pos->member != (head); pos = wlcontainerof(pos->member.next, pos, member)) Iterates over a list.

This macro expresses a for-each iterator for wllist. Given a list and wllist link member name (often named link by convention), this macro assigns each element in the list to pos, which can then be referenced in a trailing code block. For example, given a wllist of struct message elements: * struct message { * char *contents; * wllist link; * }; * * struct wllist *messagelist; * // Assume messagelist now "contains" many messages * * struct message *m; * wllistforeach(m, messagelist, link) { * dosomethingwithmessage(m); * } * Parameters: pos Cursor that each list element will be assigned to head Head of the list to iterate over member Name of the link member within the element struct

#define wllistforeachreverse(pos, head, member) [related] Value:

for (pos = wlcontainerof((head)->prev, pos, member); &pos->member != (head); pos = wlcontainerof(pos->member.prev, pos, member)) Iterates backwards over a list. See Also: wllistforeach() Parameters: pos Cursor that each list element will be assigned to head Head of the list to iterate over member Name of the link member within the element struct

#define wllistforeachreversesafe(pos, tmp, head, member) [related] Value:

for (pos = wlcontainerof((head)->prev, pos, member), tmp = wlcontainerof((pos)->member.prev, tmp, member); &pos->member != (head); pos = tmp, tmp = wlcontainerof(pos->member.prev, tmp, member)) Iterates backwards over a list, safe against removal of the list element. Note: Only removal of the current element, pos, is safe. Removing any other element during traversal may lead to a loop malfunction. See Also: wllistforeach() Parameters: pos Cursor that each list element will be assigned to tmp Temporary pointer of the same type as pos head Head of the list to iterate over member Name of the link member within the element struct

#define wllistforeachsafe(pos, tmp, head, member) [related] Value:

for (pos = wlcontainerof((head)->next, pos, member), tmp = wlcontainerof((pos)->member.next, tmp, member); &pos->member != (head); pos = tmp, tmp = wlcontainerof(pos->member.next, tmp, member)) Iterates over a list, safe against removal of the list element. Note: Only removal of the current element, pos, is safe. Removing any other element during traversal may lead to a loop malfunction. See Also: wllistforeach() Parameters: pos Cursor that each list element will be assigned to tmp Temporary pointer of the same type as pos head Head of the list to iterate over member Name of the link member within the element struct Field Documentation struct wllist* wllist::next Next list element struct wllist* wllist::prev Previous list element Author Generated automatically by Doxygen for Wayland from the source code. Version 1.15.0 Tue Oct 30 2018 wllist(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™