|
TrinityCore
|
Go to the documentation of this file.
9 #define qr_new(a_qr, a_field) do { \
10 (a_qr)->a_field.qre_next = (a_qr); \
11 (a_qr)->a_field.qre_prev = (a_qr); \
14 #define qr_next(a_qr, a_field) ((a_qr)->a_field.qre_next)
16 #define qr_prev(a_qr, a_field) ((a_qr)->a_field.qre_prev)
18 #define qr_before_insert(a_qrelm, a_qr, a_field) do { \
19 (a_qr)->a_field.qre_prev = (a_qrelm)->a_field.qre_prev; \
20 (a_qr)->a_field.qre_next = (a_qrelm); \
21 (a_qr)->a_field.qre_prev->a_field.qre_next = (a_qr); \
22 (a_qrelm)->a_field.qre_prev = (a_qr); \
25 #define qr_after_insert(a_qrelm, a_qr, a_field) \
28 (a_qr)->a_field.qre_next = (a_qrelm)->a_field.qre_next; \
29 (a_qr)->a_field.qre_prev = (a_qrelm); \
30 (a_qr)->a_field.qre_next->a_field.qre_prev = (a_qr); \
31 (a_qrelm)->a_field.qre_next = (a_qr); \
34 #define qr_meld(a_qr_a, a_qr_b, a_field) do { \
36 (a_qr_a)->a_field.qre_prev->a_field.qre_next = (a_qr_b); \
37 (a_qr_b)->a_field.qre_prev->a_field.qre_next = (a_qr_a); \
38 t = (a_qr_a)->a_field.qre_prev; \
39 (a_qr_a)->a_field.qre_prev = (a_qr_b)->a_field.qre_prev; \
40 (a_qr_b)->a_field.qre_prev = t; \
45 #define qr_split(a_qr_a, a_qr_b, a_field) \
46 qr_meld((a_qr_a), (a_qr_b), a_field)
48 #define qr_remove(a_qr, a_field) do { \
49 (a_qr)->a_field.qre_prev->a_field.qre_next \
50 = (a_qr)->a_field.qre_next; \
51 (a_qr)->a_field.qre_next->a_field.qre_prev \
52 = (a_qr)->a_field.qre_prev; \
53 (a_qr)->a_field.qre_next = (a_qr); \
54 (a_qr)->a_field.qre_prev = (a_qr); \
57 #define qr_foreach(var, a_qr, a_field) \
58 for ((var) = (a_qr); \
60 (var) = (((var)->a_field.qre_next != (a_qr)) \
61 ? (var)->a_field.qre_next : NULL))
63 #define qr_reverse_foreach(var, a_qr, a_field) \
64 for ((var) = ((a_qr) != NULL) ? qr_prev(a_qr, a_field) : NULL; \
66 (var) = (((var) != (a_qr)) \
67 ? (var)->a_field.qre_prev : NULL))