comparison src/core/ngx_radix_tree.c @ 50:72eb30262aac NGINX_0_1_25

nginx 0.1.25 *) Bugfix: nginx did run on Linux parisc. *) Feature: nginx now does not start under FreeBSD if the sysctl kern.ipc.somaxconn value is too big. *) Bugfix: if a request was internally redirected by the ngx_http_index_module module to the ngx_http_proxy_module or ngx_http_fastcgi_module modules, then the index file was not closed after request completion. *) Feature: the "proxy_pass" can be used in location with regular expression. *) Feature: the ngx_http_rewrite_filter_module module supports the condition like "if ($HTTP_USER_AGENT ~ MSIE)". *) Bugfix: nginx started too slow if the large number of addresses and text values were used in the "geo" directive. *) Change: a variable name must be declared as "$name" in the "geo" directive. The previous variant without "$" is still supported, but will be removed soon. *) Feature: the "%{VARIABLE}v" logging parameter. *) Feature: the "set $name value" directive. *) Bugfix: gcc 4.0 compatibility. *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
author Igor Sysoev <http://sysoev.ru>
date Sat, 19 Mar 2005 00:00:00 +0300
parents 6cfc63e68377
children 408f195b3482
comparison
equal deleted inserted replaced
49:93dabbc9efb9 50:72eb30262aac
15 ngx_radix_tree_create(ngx_pool_t *pool, ngx_int_t preallocate) 15 ngx_radix_tree_create(ngx_pool_t *pool, ngx_int_t preallocate)
16 { 16 {
17 uint32_t key, mask, inc; 17 uint32_t key, mask, inc;
18 ngx_radix_tree_t *tree; 18 ngx_radix_tree_t *tree;
19 19
20 if (!(tree = ngx_palloc(pool, sizeof(ngx_radix_tree_t)))) { 20 tree = ngx_palloc(pool, sizeof(ngx_radix_tree_t));
21 if (tree == NULL) {
21 return NULL; 22 return NULL;
22 } 23 }
23 24
24 tree->pool = pool; 25 tree->pool = pool;
25 tree->free = NULL; 26 tree->free = NULL;
26 tree->start = NULL; 27 tree->start = NULL;
27 tree->size = 0; 28 tree->size = 0;
28 29
29 if (!(tree->root = ngx_radix_alloc(tree))) { 30 tree->root = ngx_radix_alloc(tree);
31 if (tree->root == NULL) {
30 return NULL; 32 return NULL;
31 } 33 }
32 34
33 tree->root->right = NULL; 35 tree->root->right = NULL;
34 tree->root->left = NULL; 36 tree->root->left = NULL;
138 node->value = value; 140 node->value = value;
139 return NGX_OK; 141 return NGX_OK;
140 } 142 }
141 143
142 while (bit & mask) { 144 while (bit & mask) {
143 if (!(next = ngx_radix_alloc(tree))) { 145 next = ngx_radix_alloc(tree);
146 if (next == NULL) {
144 return NGX_ERROR; 147 return NGX_ERROR;
145 } 148 }
146 149
147 next->right = NULL; 150 next->right = NULL;
148 next->left = NULL; 151 next->left = NULL;
264 tree->free = tree->free->right; 267 tree->free = tree->free->right;
265 return p; 268 return p;
266 } 269 }
267 270
268 if (tree->size < sizeof(ngx_radix_node_t)) { 271 if (tree->size < sizeof(ngx_radix_node_t)) {
269 if (!(tree->start = ngx_palloc(tree->pool, ngx_pagesize))) { 272 tree->start = ngx_palloc(tree->pool, ngx_pagesize);
273 if (tree->start == NULL) {
270 return NULL; 274 return NULL;
271 } 275 }
272 276
273 tree->size = ngx_pagesize; 277 tree->size = ngx_pagesize;
274 } 278 }