Mercurial > hg > nginx-vendor-current
annotate src/core/ngx_queue.c @ 622:8dc007eddbcf NGINX_1_0_1
nginx 1.0.1
*) Change: now the "split_clients" directive uses MurmurHash2 algorithm
because of better distribution.
Thanks to Oleg Mamontov.
*) Change: now long strings starting with zero are not considered as
false values.
Thanks to Maxim Dounin.
*) Change: now nginx uses a default listen backlog value 511 on Linux.
*) Feature: the $upstream_... variables may be used in the SSI and perl
modules.
*) Bugfix: now nginx limits better disk cache size.
Thanks to Oleg Mamontov.
*) Bugfix: a segmentation fault might occur while parsing incorrect
IPv4 address; the bug had appeared in 0.9.3.
Thanks to Maxim Dounin.
*) Bugfix: nginx could not be built by gcc 4.6 without --with-debug
option.
*) Bugfix: nginx could not be built on Solaris 9 and earlier; the bug
had appeared in 0.9.3.
Thanks to Dagobert Michelsen.
*) Bugfix: $request_time variable had invalid values if subrequests
were used; the bug had appeared in 0.8.47.
Thanks to Igor A. Valcov.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 03 May 2011 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 } |