comparison src/core/ngx_cycle.c @ 2049:2a92804f4109

*) back out r2040 *) refactor ngx_palloc() *) introduce ngx_pnalloc() *) additional pool blocks have smaller header
author Igor Sysoev <igor@sysoev.ru>
date Tue, 17 Jun 2008 15:00:30 +0000
parents b56d4b1ebac7
children 01b71aa095cc
comparison
equal deleted inserted replaced
2048:824615f3b4ec 2049:2a92804f4109
79 cycle->root.len = sizeof(NGX_PREFIX) - 1; 79 cycle->root.len = sizeof(NGX_PREFIX) - 1;
80 cycle->root.data = (u_char *) NGX_PREFIX; 80 cycle->root.data = (u_char *) NGX_PREFIX;
81 81
82 82
83 cycle->conf_file.len = old_cycle->conf_file.len; 83 cycle->conf_file.len = old_cycle->conf_file.len;
84 cycle->conf_file.data = ngx_palloc(pool, old_cycle->conf_file.len + 1); 84 cycle->conf_file.data = ngx_pnalloc(pool, old_cycle->conf_file.len + 1);
85 if (cycle->conf_file.data == NULL) { 85 if (cycle->conf_file.data == NULL) {
86 ngx_destroy_pool(pool); 86 ngx_destroy_pool(pool);
87 return NULL; 87 return NULL;
88 } 88 }
89 ngx_cpystrn(cycle->conf_file.data, old_cycle->conf_file.data, 89 ngx_cpystrn(cycle->conf_file.data, old_cycle->conf_file.data,
180 /* on Linux gethostname() silently truncates name that does not fit */ 180 /* on Linux gethostname() silently truncates name that does not fit */
181 181
182 hostname[NGX_MAXHOSTNAMELEN - 1] = '\0'; 182 hostname[NGX_MAXHOSTNAMELEN - 1] = '\0';
183 cycle->hostname.len = ngx_strlen(hostname); 183 cycle->hostname.len = ngx_strlen(hostname);
184 184
185 cycle->hostname.data = ngx_palloc(pool, cycle->hostname.len); 185 cycle->hostname.data = ngx_pnalloc(pool, cycle->hostname.len);
186 if (cycle->hostname.data == NULL) { 186 if (cycle->hostname.data == NULL) {
187 ngx_destroy_pool(pool); 187 ngx_destroy_pool(pool);
188 return NULL; 188 return NULL;
189 } 189 }
190 190
458 458
459 lock_file = NULL; 459 lock_file = NULL;
460 460
461 #else 461 #else
462 462
463 lock_file = ngx_palloc(cycle->pool, 463 lock_file = ngx_pnalloc(cycle->pool,
464 cycle->lock_file.len + shm_zone[i].name.len); 464 cycle->lock_file.len + shm_zone[i].name.len);
465 465
466 if (lock_file == NULL) { 466 if (lock_file == NULL) {
467 goto failed; 467 goto failed;
468 } 468 }
469 469