Go to the documentation of this file.
33#ifndef _NETSURF_UTILS_RING_H_
34#define _NETSURF_UTILS_RING_H_
40#define RING_INSERT(ring,element) \
43 element->r_next = ring; \
44 element->r_prev = ring->r_prev; \
45 ring->r_prev = element; \
46 element->r_prev->r_next = element; \
48 ring = element->r_prev = element->r_next = element
53#define RING_REMOVE(ring, element) \
55 if (element->r_next != element ) { \
57 element->r_next->r_prev = element->r_prev; \
58 element->r_prev->r_next = element->r_next; \
59 if (ring == element) ring = element->r_next; \
64 element->r_next = element->r_prev = 0
69#define RING_FINDBYLWCHOST(ring, element, lwc_hostname) \
75 if (lwc_string_isequal(element->host, lwc_hostname, \
76 &found) == lwc_error_ok && \
80 element = element->r_next; \
81 } while (element != ring); \
82 if (!found) element = 0; \
86#define RING_GETSIZE(ringtype, ring, sizevar) \
94 } while (p != ring); \
98#define RING_COUNTBYLWCHOST(ringtype, ring, sizevar, lwc_hostname) \
101 ringtype *p = ring; \
104 bool matches = false; \
106 if (lwc_string_isequal(p->host, lwc_hostname, \
107 &matches) == lwc_error_ok) \
111 } while (p != ring); \
127#define RING_ITERATE_START(ringtype, ring, iteratorptr) \
128 if (ring != NULL) { \
129 ringtype *iteratorptr = ring; \
133#define RING_ITERATE_STOP(ring, iteratorptr) \
134 goto iteration_end_ring##_##iteratorptr
136#define RING_ITERATE_END(ring, iteratorptr) \
138 iteratorptr = iteratorptr->r_next; \
139 } while (iteratorptr != ring); \
141 iteration_end_ring##_##iteratorptr: