comparison src/core/ngx_array.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 aab2ea7c0458
children bb61aa162c6b
comparison
equal deleted inserted replaced
49:93dabbc9efb9 50:72eb30262aac
10 10
11 ngx_array_t *ngx_array_create(ngx_pool_t *p, ngx_uint_t n, size_t size) 11 ngx_array_t *ngx_array_create(ngx_pool_t *p, ngx_uint_t n, size_t size)
12 { 12 {
13 ngx_array_t *a; 13 ngx_array_t *a;
14 14
15 if (!(a = ngx_palloc(p, sizeof(ngx_array_t)))) { 15 a = ngx_palloc(p, sizeof(ngx_array_t));
16 if (a == NULL) {
16 return NULL; 17 return NULL;
17 } 18 }
18 19
19 if (!(a->elts = ngx_palloc(p, n * size))) { 20 a->elts = ngx_palloc(p, n * size);
21 if (a->elts == NULL) {
20 return NULL; 22 return NULL;
21 } 23 }
22 24
23 a->nelts = 0; 25 a->nelts = 0;
24 a->size = size; 26 a->size = size;
70 a->nalloc++; 72 a->nalloc++;
71 73
72 } else { 74 } else {
73 /* allocate a new array */ 75 /* allocate a new array */
74 76
75 if (!(new = ngx_palloc(p, 2 * size))) { 77 new = ngx_palloc(p, 2 * size);
78 if (new == NULL) {
76 return NULL; 79 return NULL;
77 } 80 }
78 81
79 ngx_memcpy(new, a->elts, size); 82 ngx_memcpy(new, a->elts, size);
80 a->elts = new; 83 a->elts = new;
118 } else { 121 } else {
119 /* allocate a new array */ 122 /* allocate a new array */
120 123
121 nalloc = 2 * ((n >= a->nalloc) ? n : a->nalloc); 124 nalloc = 2 * ((n >= a->nalloc) ? n : a->nalloc);
122 125
123 if (!(new = ngx_palloc(p, nalloc * a->size))) { 126 new = ngx_palloc(p, nalloc * a->size);
127 if (new == NULL) {
124 return NULL; 128 return NULL;
125 } 129 }
126 130
127 ngx_memcpy(new, a->elts, a->nelts * a->size); 131 ngx_memcpy(new, a->elts, a->nelts * a->size);
128 a->elts = new; 132 a->elts = new;