mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-04 03:02:07 +00:00
MINOR: lists: add LIST_ADDED() to check if an element belongs to a list
Some code parts use LIST_ISEMPTY() a lot on list elements to detect if they were reset consecutive to their removal from a list, but this test is always confusing as this was initially designed for list heads. Instead let's have a new macro, LIST_ADDED(), which returns true when the element is in a list (i.e. it's not "empty").
This commit is contained in:
parent
478281f55d
commit
42ccb5ac45
@ -111,6 +111,11 @@ struct cond_wordlist {
|
||||
/* checks if the list head <lh> is empty or not */
|
||||
#define LIST_ISEMPTY(lh) ((lh)->n == (lh))
|
||||
|
||||
/* checks if the list element <el> was added to a list or not. This only
|
||||
* works when detached elements are reinitialized (using LIST_DEL_INIT)
|
||||
*/
|
||||
#define LIST_ADDED(el) ((el)->n != (el))
|
||||
|
||||
/* returns a pointer of type <pt> to a structure following the element
|
||||
* which contains list head <lh>, which is known as element <el> in
|
||||
* struct pt.
|
||||
|
Loading…
Reference in New Issue
Block a user