comparison src/core/ngx_queue.h @ 1646:9638a809d3cd

ngx_queue.h
author Igor Sysoev <igor@sysoev.ru>
date Fri, 23 Nov 2007 16:32:50 +0000
parents
children d95dea42c33f
comparison
equal deleted inserted replaced
1645:31622d9f2c0d 1646:9638a809d3cd
1
2 /*
3 * Copyright (C) Igor Sysoev
4 */
5
6
7 #include <ngx_config.h>
8 #include <ngx_core.h>
9
10
11 #ifndef _NGX_QUEUE_H_INCLUDED_
12 #define _NGX_QUEUE_H_INCLUDED_
13
14
15 typedef struct ngx_queue_s ngx_queue_t;
16
17 struct ngx_queue_s {
18 ngx_queue_t *prev;
19 ngx_queue_t *next;
20 };
21
22
23 #define ngx_queue_empty(h) \
24 (h == (h)->prev)
25
26
27 #define ngx_queue_insert_head(h, x) \
28 (x)->next = (h)->next; \
29 (x)->next->prev = x; \
30 (x)->prev = h; \
31 (h)->next = x
32
33
34 #define ngx_queue_head(h) \
35 (h)->next
36
37
38 #define ngx_queue_last(h) \
39 (h)->prev
40
41
42 #if (NGX_DEBUG)
43
44 #define ngx_queue_remove(x) \
45 (x)->next->prev = (x)->prev; \
46 (x)->prev->next = (x)->next; \
47 (x)->prev = NULL; \
48 (x)->next = NULL
49
50 #else
51
52 #define ngx_queue_remove(x) \
53 (x)->next->prev = (x)->prev; \
54 (x)->prev->next = (x)->next
55
56 #endif
57
58
59 #define ngx_queue_data(q, type, link) \
60 (type *) ((u_char *) q - offsetof(type, link))
61
62
63 #endif /* _NGX_QUEUE_H_INCLUDED_ */