fred-mod-eppd
Classes | Macros | Typedefs | Functions
Queue structure and utilities

Classes

struct  qitem
 
struct  qhead
 

Macros

#define q_length(_qhead)   ((_qhead).count)
 
#define q_next(_qhead)   ((_qhead)->cur = ((_qhead)->cur) ? (_qhead)->cur->next : NULL)
 
#define q_content(_qhead)   ((_qhead)->cur->content)
 
#define q_reset(_qhead)   ((_qhead)->cur = (_qhead)->body)
 
#define q_foreach(_qhead)   for ((_qhead)->cur = (_qhead)->body; (_qhead)->cur != NULL; (_qhead)->cur = (_qhead)->cur->next)
 

Typedefs

typedef struct qitem qitem
 

Functions

int q_add (void *pool, qhead *head, void *data)
 

Detailed Description

Macro Definition Documentation

◆ q_content

#define q_content (   _qhead)    ((_qhead)->cur->content)

Get content of current item.

◆ q_foreach

#define q_foreach (   _qhead)    for ((_qhead)->cur = (_qhead)->body; (_qhead)->cur != NULL; (_qhead)->cur = (_qhead)->cur->next)

Iterate through items in a list. At first, internal pointer is set to the list begining then it advances each round to the next item in a list, until the sentinel is encountered.

◆ q_length

#define q_length (   _qhead)    ((_qhead).count)

Get length of a queue.

◆ q_next

#define q_next (   _qhead)    ((_qhead)->cur = ((_qhead)->cur) ? (_qhead)->cur->next : NULL)

Shift to next item in a queue.

◆ q_reset

#define q_reset (   _qhead)    ((_qhead)->cur = (_qhead)->body)

Reset current item to the first one.

Typedef Documentation

◆ qitem

typedef struct qitem qitem

Queue item type.

Function Documentation

◆ q_add()

int q_add ( void *  pool,
qhead head,
void *  data 
)

Add new item to a queue (the item will be enqueued at the end of queue).

Parameters
poolPool from which the new item will be allocated.
headThe queue.
dataPointer to data which shoud be enqueued.
Returns
0 if successfull, otherwise 1.