Rizin
unix-like reverse engineering framework and cli tools
queue.h File Reference
#include <stddef.h>

Go to the source code of this file.

Macros

#define QUEUE_NEXT(q)   (*(QUEUE **) &((*(q))[0]))
 
#define QUEUE_PREV(q)   (*(QUEUE **) &((*(q))[1]))
 
#define QUEUE_PREV_NEXT(q)   (QUEUE_NEXT(QUEUE_PREV(q)))
 
#define QUEUE_NEXT_PREV(q)   (QUEUE_PREV(QUEUE_NEXT(q)))
 
#define QUEUE_DATA(ptr, type, field)    ((type *) ((char *) (ptr) - offsetof(type, field)))
 
#define QUEUE_FOREACH(q, h)    for ((q) = QUEUE_NEXT(h); (q) != (h); (q) = QUEUE_NEXT(q))
 
#define QUEUE_EMPTY(q)    ((const QUEUE *) (q) == (const QUEUE *) QUEUE_NEXT(q))
 
#define QUEUE_HEAD(q)    (QUEUE_NEXT(q))
 
#define QUEUE_INIT(q)
 
#define QUEUE_ADD(h, n)
 
#define QUEUE_SPLIT(h, q, n)
 
#define QUEUE_MOVE(h, n)
 
#define QUEUE_INSERT_HEAD(h, q)
 
#define QUEUE_INSERT_TAIL(h, q)
 
#define QUEUE_REMOVE(q)
 

Typedefs

typedef void * QUEUE[2]
 

Macro Definition Documentation

◆ QUEUE_ADD

#define QUEUE_ADD (   h,
  n 
)
Value:
do { \
QUEUE_PREV_NEXT(h) = QUEUE_NEXT(n); \
QUEUE_NEXT_PREV(n) = QUEUE_PREV(h); \
QUEUE_PREV(h) = QUEUE_PREV(n); \
QUEUE_PREV_NEXT(h) = (h); \
} \
while (0)
int n
Definition: mipsasm.c:19
#define QUEUE_PREV(q)
Definition: queue.h:25
#define QUEUE_NEXT(q)
Definition: queue.h:24
#define h(i)
Definition: sha256.c:48

Definition at line 52 of file queue.h.

◆ QUEUE_DATA

#define QUEUE_DATA (   ptr,
  type,
  field 
)     ((type *) ((char *) (ptr) - offsetof(type, field)))

Definition at line 30 of file queue.h.

◆ QUEUE_EMPTY

#define QUEUE_EMPTY (   q)     ((const QUEUE *) (q) == (const QUEUE *) QUEUE_NEXT(q))

Definition at line 39 of file queue.h.

◆ QUEUE_FOREACH

#define QUEUE_FOREACH (   q,
  h 
)     for ((q) = QUEUE_NEXT(h); (q) != (h); (q) = QUEUE_NEXT(q))

Definition at line 36 of file queue.h.

◆ QUEUE_HEAD

#define QUEUE_HEAD (   q)     (QUEUE_NEXT(q))

Definition at line 42 of file queue.h.

◆ QUEUE_INIT

#define QUEUE_INIT (   q)
Value:
do { \
QUEUE_NEXT(q) = (q); \
QUEUE_PREV(q) = (q); \
} \
while (0)

Definition at line 45 of file queue.h.

◆ QUEUE_INSERT_HEAD

#define QUEUE_INSERT_HEAD (   h,
 
)
Value:
do { \
QUEUE_NEXT(q) = QUEUE_NEXT(h); \
QUEUE_PREV(q) = (h); \
QUEUE_NEXT_PREV(q) = (q); \
QUEUE_NEXT(h) = (q); \
} \
while (0)

Definition at line 83 of file queue.h.

◆ QUEUE_INSERT_TAIL

#define QUEUE_INSERT_TAIL (   h,
 
)
Value:
do { \
QUEUE_NEXT(q) = (h); \
QUEUE_PREV(q) = QUEUE_PREV(h); \
QUEUE_PREV_NEXT(q) = (q); \
QUEUE_PREV(h) = (q); \
} \
while (0)

Definition at line 92 of file queue.h.

◆ QUEUE_MOVE

#define QUEUE_MOVE (   h,
  n 
)
Value:
do { \
if (QUEUE_EMPTY(h)) \
QUEUE_INIT(n); \
else { \
QUEUE* q = QUEUE_HEAD(h); \
QUEUE_SPLIT(h, q, n); \
} \
} \
while (0)
#define QUEUE_EMPTY(q)
Definition: queue.h:39
#define QUEUE_HEAD(q)
Definition: queue.h:42

Definition at line 72 of file queue.h.

◆ QUEUE_NEXT

#define QUEUE_NEXT (   q)    (*(QUEUE **) &((*(q))[0]))

Definition at line 24 of file queue.h.

◆ QUEUE_NEXT_PREV

#define QUEUE_NEXT_PREV (   q)    (QUEUE_PREV(QUEUE_NEXT(q)))

Definition at line 27 of file queue.h.

◆ QUEUE_PREV

#define QUEUE_PREV (   q)    (*(QUEUE **) &((*(q))[1]))

Definition at line 25 of file queue.h.

◆ QUEUE_PREV_NEXT

#define QUEUE_PREV_NEXT (   q)    (QUEUE_NEXT(QUEUE_PREV(q)))

Definition at line 26 of file queue.h.

◆ QUEUE_REMOVE

#define QUEUE_REMOVE (   q)
Value:
do { \
QUEUE_PREV_NEXT(q) = QUEUE_NEXT(q); \
QUEUE_NEXT_PREV(q) = QUEUE_PREV(q); \
} \
while (0)

Definition at line 101 of file queue.h.

◆ QUEUE_SPLIT

#define QUEUE_SPLIT (   h,
  q,
  n 
)
Value:
do { \
QUEUE_PREV(n) = QUEUE_PREV(h); \
QUEUE_PREV_NEXT(n) = (n); \
QUEUE_NEXT(n) = (q); \
QUEUE_PREV(h) = QUEUE_PREV(q); \
QUEUE_PREV_NEXT(h) = (h); \
QUEUE_PREV(q) = (n); \
} \
while (0)

Definition at line 61 of file queue.h.

Typedef Documentation

◆ QUEUE

typedef void* QUEUE[2]

Definition at line 21 of file queue.h.