Mercurial > hg > nginx-vendor-current
annotate src/core/ngx_queue.c @ 482:392c16f2d858 NGINX_0_7_53
nginx 0.7.53
*) Change: now a log set by --error-log-path is created from the very
start-up.
*) Feature: now the start up errors and warnings are outputted to an
error_log and stderr.
*) Feature: the empty --prefix= configure parameter forces nginx to use
a directory where it was run as prefix.
*) Feature: the -p switch.
*) Feature: the -s switch on Unix platforms.
*) Feature: the -? and -h switches.
Thanks to Jerome Loyet.
*) Feature: now switches may be set in condensed form.
*) Bugfix: nginx/Windows did not work if configuration file was given
by the -c switch.
*) Bugfix: temporary files might be not removed if the "proxy_store",
"fastcgi_store", "proxy_cache", or "fastcgi_cache" were used.
Thanks to Maxim Dounin.
*) Bugfix: an incorrect value was passed to mail proxy authentication
server in "Auth-Method" header line; the bug had appeared
in 0.7.34.
Thanks to Simon Lecaille.
*) Bugfix: system error text descriptions were not logged on Linux;
the bug had appeared in 0.7.45.
*) Bugfix: the "fastcgi_cache_min_uses" directive did not work.
Thanks to Andrew Vorobyoff.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 27 Apr 2009 00:00:00 +0400 |
parents | 820f6378fc00 |
children | d0f7a625f27c |
rev | line source |
---|---|
378 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #include <ngx_config.h> | |
8 #include <ngx_core.h> | |
9 | |
10 | |
11 /* | |
12 * find the middle queue element if the queue has odd number of elements | |
13 * or the first element of the queue's second part otherwise | |
14 */ | |
15 | |
16 ngx_queue_t * | |
17 ngx_queue_middle(ngx_queue_t *queue) | |
18 { | |
19 ngx_queue_t *middle, *next; | |
20 | |
21 middle = ngx_queue_head(queue); | |
22 | |
23 if (middle == ngx_queue_last(queue)) { | |
24 return middle; | |
25 } | |
26 | |
27 next = ngx_queue_head(queue); | |
28 | |
29 for ( ;; ) { | |
30 middle = ngx_queue_next(middle); | |
31 | |
32 next = ngx_queue_next(next); | |
33 | |
34 if (next == ngx_queue_last(queue)) { | |
35 return middle; | |
36 } | |
37 | |
38 next = ngx_queue_next(next); | |
39 | |
40 if (next == ngx_queue_last(queue)) { | |
41 return middle; | |
42 } | |
43 } | |
44 } | |
45 | |
46 | |
47 /* the stable insertion sort */ | |
48 | |
49 void | |
50 ngx_queue_sort(ngx_queue_t *queue, | |
51 ngx_int_t (*cmp)(const ngx_queue_t *, const ngx_queue_t *)) | |
52 { | |
53 ngx_queue_t *q, *prev, *next; | |
54 | |
55 q = ngx_queue_head(queue); | |
56 | |
57 if (q == ngx_queue_last(queue)) { | |
58 return; | |
59 } | |
60 | |
61 for (q = ngx_queue_next(q); q != ngx_queue_sentinel(queue); q = next) { | |
62 | |
63 prev = ngx_queue_prev(q); | |
64 next = ngx_queue_next(q); | |
65 | |
66 ngx_queue_remove(q); | |
67 | |
68 do { | |
69 if (cmp(prev, q) <= 0) { | |
70 break; | |
71 } | |
72 | |
73 prev = ngx_queue_prev(prev); | |
74 | |
75 } while (prev != ngx_queue_sentinel(queue)); | |
76 | |
77 ngx_queue_insert_after(prev, q); | |
78 } | |
79 } |