list.h revision b26fa1a2fbcfee7d03b0c8fd15ec3aa64ae70b9f
#pragma once
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
/* The head of the linked list. Use this in the structure that shall
* contain the head of the linked list */
t *name
/* The pointers in the linked list's items. Use this in the item structure */
#define LIST_FIELDS(t,name) \
/* Initialize the list's head */
#define LIST_HEAD_INIT(head) \
do { \
while(false)
/* Initialize a list item */
do { \
} while(false)
/* Prepend an item to the list */
do { \
} while(false)
/* Append an item to the list */
do { \
} while(false)
/* Remove an item from the list */
do { \
else { \
} \
} while(false)
/* Find the head of the list */
do { \
if (!_item) \
else { \
} \
} while (false)
/* Find the tail of the list */
do { \
if (!_item) \
else { \
} \
} while (false)
/* Insert an item after another one (a = where, b = what) */
do { \
if (!_a) { \
} else { \
} \
} while(false)
/* Insert an item before another one (a = where, b = what) */
do { \
if (!_a) { \
if (!*_head) { \
} else { \
} \
} else { \
} \
} while(false)
#define LIST_FOREACH_BEFORE(name,i,p) \
#define LIST_FOREACH_AFTER(name,i,p) \
/* Iterate through all the members of the list p is included in, but skip over p */
#define LIST_FOREACH_OTHERS(name,i,p) \
for (({ \
(i) = (p); \
if ((i) == (p)) \
}); \
(i); \
/* Loop starting from p->next until p->prev.
p can be adjusted meanwhile. */
(i) != (p); \