comparison src/core/ngx_palloc.c @ 178:87699398f955 NGINX_0_3_36

nginx 0.3.36 *) Feature: the ngx_http_addition_filter_module. *) Feature: the "proxy_pass" and "fastcgi_pass" directives may be used inside the "if" block. *) Feature: the "proxy_ignore_client_abort" and "fastcgi_ignore_client_abort" directives. *) Feature: the "$request_completion" variable. *) Feature: the ngx_http_perl_module supports the $r->request_method and $r->remote_addr. *) Feature: the ngx_http_ssi_module supports the "elif" command. *) Bugfix: the "\/" string in the expression of the "if" command of the ngx_http_ssi_module was treated incorrectly. *) Bugfix: in the regular expressions in the "if" command of the ngx_http_ssi_module. *) Bugfix: if the relative path was specified in the "client_body_temp_path", "proxy_temp_path", "fastcgi_temp_path", and "perl_modules" directives, then the directory was used relatively to a current path but not to a server prefix.
author Igor Sysoev <http://sysoev.ru>
date Wed, 05 Apr 2006 00:00:00 +0400
parents bb61aa162c6b
children 6ae1357b7b7c
comparison
equal deleted inserted replaced
177:4a3ddd758222 178:87699398f955
84 void * 84 void *
85 ngx_palloc(ngx_pool_t *pool, size_t size) 85 ngx_palloc(ngx_pool_t *pool, size_t size)
86 { 86 {
87 u_char *m; 87 u_char *m;
88 ngx_pool_t *p, *n; 88 ngx_pool_t *p, *n;
89 ngx_pool_large_t *large, *last; 89 ngx_pool_large_t *large;
90 90
91 if (size <= (size_t) NGX_MAX_ALLOC_FROM_POOL 91 if (size <= (size_t) NGX_MAX_ALLOC_FROM_POOL
92 && size <= (size_t) (pool->end - (u_char *) pool) 92 && size <= (size_t) (pool->end - (u_char *) pool)
93 - (size_t) ngx_align_ptr(sizeof(ngx_pool_t), NGX_ALIGNMENT)) 93 - (size_t) ngx_align_ptr(sizeof(ngx_pool_t), NGX_ALIGNMENT))
94 { 94 {
132 n->last = m + size; 132 n->last = m + size;
133 133
134 return m; 134 return m;
135 } 135 }
136 136
137 /* allocate a large block */
138
139 large = NULL;
140 last = NULL;
141
142 if (pool->large) {
143 for (last = pool->large; /* void */ ; last = last->next) {
144 if (last->alloc == NULL) {
145 large = last;
146 last = NULL;
147 break;
148 }
149
150 if (last->next == NULL) {
151 break;
152 }
153 }
154 }
155
156 if (large == NULL) {
157 large = ngx_palloc(pool, sizeof(ngx_pool_large_t));
158 if (large == NULL) {
159 return NULL;
160 }
161
162 large->next = NULL;
163 }
164
165 #if 0 137 #if 0
166 p = ngx_memalign(ngx_pagesize, size, pool->log); 138 p = ngx_memalign(ngx_pagesize, size, pool->log);
167 if (p == NULL) { 139 if (p == NULL) {
168 return NULL; 140 return NULL;
169 } 141 }
172 if (p == NULL) { 144 if (p == NULL) {
173 return NULL; 145 return NULL;
174 } 146 }
175 #endif 147 #endif
176 148
177 if (pool->large == NULL) { 149 large = ngx_palloc(pool, sizeof(ngx_pool_large_t));
178 pool->large = large; 150 if (large == NULL) {
179 151 return NULL;
180 } else if (last) {
181 last->next = large;
182 } 152 }
183 153
184 large->alloc = p; 154 large->alloc = p;
155 large->next = pool->large;
156 pool->large = large;
185 157
186 return p; 158 return p;
187 } 159 }
188 160
189 161