Defines
llist.h File Reference
#include <assert.h>
#include <avahi-common/cdecl.h>
Include dependency graph for llist.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define AVAHI_LLIST_FIELDS(t, name)   t *name##_next, *name##_prev
#define AVAHI_LLIST_HEAD(t, name)   t *name
#define AVAHI_LLIST_HEAD_INIT(t, head)   do { (head) = NULL; } while(0)
#define AVAHI_LLIST_INIT(t, name, item)
#define AVAHI_LLIST_PREPEND(t, name, head, item)
#define AVAHI_LLIST_REMOVE(t, name, head, item)

Detailed Description

A simple macro based linked list implementation

Definition in file llist.h.


Define Documentation

#define AVAHI_LLIST_FIELDS (   t,
  name 
)    t *name##_next, *name##_prev

The pointers in the linked list's items. Use this in the item structure

Definition at line 38 of file llist.h.

#define AVAHI_LLIST_HEAD (   t,
  name 
)    t *name

The head of the linked list. Use this in the structure that shall contain the head of the linked list

Definition at line 35 of file llist.h.

#define AVAHI_LLIST_HEAD_INIT (   t,
  head 
)    do { (head) = NULL; } while(0)

Initialize the list's head

Definition at line 41 of file llist.h.

#define AVAHI_LLIST_INIT (   t,
  name,
  item 
)
Value:
do { \
                               t *_item = (item); \
                               assert(_item); \
                               _item->name##_prev = _item->name##_next = NULL; \
                               } while(0)

Initialize a list item

Definition at line 44 of file llist.h.

#define AVAHI_LLIST_PREPEND (   t,
  name,
  head,
  item 
)
Value:
do { \
                                        t **_head = &(head), *_item = (item); \
                                        assert(_item); \
                                        if ((_item->name##_next = *_head)) \
                                           _item->name##_next->name##_prev = _item; \
                                        _item->name##_prev = NULL; \
                                        *_head = _item; \
                                        } while (0)

Prepend an item to the list

Definition at line 51 of file llist.h.

#define AVAHI_LLIST_REMOVE (   t,
  name,
  head,
  item 
)
Value:
do { \
                                    t **_head = &(head), *_item = (item); \
                                    assert(_item); \
                                    if (_item->name##_next) \
                                       _item->name##_next->name##_prev = _item->name##_prev; \
                                    if (_item->name##_prev) \
                                       _item->name##_prev->name##_next = _item->name##_next; \
                                    else {\
                                       assert(*_head == _item); \
                                       *_head = _item->name##_next; \
                                    } \
                                    _item->name##_next = _item->name##_prev = NULL; \
                                    } while(0)

Remove an item from the list

Definition at line 61 of file llist.h.



pedal_monitor
Author(s): Pedro Mendes
autogenerated on Fri Jun 6 2014 18:37:21