diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/nginx.h | 2 | ||||
-rw-r--r-- | src/core/ngx_conf_file.c | 19 | ||||
-rw-r--r-- | src/core/ngx_file.c | 7 | ||||
-rw-r--r-- | src/core/ngx_palloc.c | 40 |
4 files changed, 29 insertions, 39 deletions
diff --git a/src/core/nginx.h b/src/core/nginx.h index 46d0a3dd4..3f910cb26 100644 --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -8,7 +8,7 @@ #define _NGINX_H_INCLUDED_ -#define NGINX_VER "nginx/0.3.35" +#define NGINX_VER "nginx/0.3.36" #define NGINX_VAR "NGINX" #define NGX_OLDPID_EXT ".oldbin" diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c index ab097c049..7c22948a3 100644 --- a/src/core/ngx_conf_file.c +++ b/src/core/ngx_conf_file.c @@ -63,6 +63,7 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename) char *rv; ngx_fd_t fd; ngx_int_t rc; + ngx_buf_t *b; ngx_uint_t block; ngx_conf_file_t *prev; @@ -95,11 +96,23 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename) ngx_fd_info_n " \"%s\" failed", filename->data); } - cf->conf_file->buffer = ngx_create_temp_buf(cf->pool, ngx_pagesize); - if (cf->conf_file->buffer == NULL) { + b = ngx_calloc_buf(cf->pool); + if (b == NULL) { return NGX_CONF_ERROR; } + cf->conf_file->buffer = b; + + b->start = ngx_alloc(ngx_pagesize, cf->log); + if (b->start == NULL) { + return NGX_CONF_ERROR; + } + + b->pos = b->start; + b->last = b->start; + b->end = b->last + ngx_pagesize; + b->temporary = 1; + cf->conf_file->file.fd = fd; cf->conf_file->file.name.len = filename->len; cf->conf_file->file.name.data = filename->data; @@ -183,7 +196,7 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename) if (filename) { - ngx_pfree(cf->pool, cf->conf_file->buffer->start); + ngx_free(cf->conf_file->buffer->start); cf->conf_file = prev; diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c index 0c6576087..e3e719022 100644 --- a/src/core/ngx_file.c +++ b/src/core/ngx_file.c @@ -211,8 +211,8 @@ ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) char *p = conf; ssize_t level; - ngx_uint_t i, n; ngx_str_t *value; + ngx_uint_t i, n; ngx_path_t *path, **slot; slot = (ngx_path_t **) (p + cmd->offset); @@ -229,6 +229,11 @@ ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) value = cf->args->elts; path->name = value[1]; + + if (ngx_conf_full_name(cf->cycle, &path->name) == NGX_ERROR) { + return NULL; + } + path->len = 0; path->cleaner = (ngx_gc_handler_pt) cmd->post; path->conf_file = cf->conf_file->file.name.data; diff --git a/src/core/ngx_palloc.c b/src/core/ngx_palloc.c index eb0e86d0a..1797e96d0 100644 --- a/src/core/ngx_palloc.c +++ b/src/core/ngx_palloc.c @@ -86,7 +86,7 @@ ngx_palloc(ngx_pool_t *pool, size_t size) { u_char *m; ngx_pool_t *p, *n; - ngx_pool_large_t *large, *last; + ngx_pool_large_t *large; if (size <= (size_t) NGX_MAX_ALLOC_FROM_POOL && size <= (size_t) (pool->end - (u_char *) pool) @@ -134,34 +134,6 @@ ngx_palloc(ngx_pool_t *pool, size_t size) return m; } - /* allocate a large block */ - - large = NULL; - last = NULL; - - if (pool->large) { - for (last = pool->large; /* void */ ; last = last->next) { - if (last->alloc == NULL) { - large = last; - last = NULL; - break; - } - - if (last->next == NULL) { - break; - } - } - } - - if (large == NULL) { - large = ngx_palloc(pool, sizeof(ngx_pool_large_t)); - if (large == NULL) { - return NULL; - } - - large->next = NULL; - } - #if 0 p = ngx_memalign(ngx_pagesize, size, pool->log); if (p == NULL) { @@ -174,14 +146,14 @@ ngx_palloc(ngx_pool_t *pool, size_t size) } #endif - if (pool->large == NULL) { - pool->large = large; - - } else if (last) { - last->next = large; + large = ngx_palloc(pool, sizeof(ngx_pool_large_t)); + if (large == NULL) { + return NULL; } large->alloc = p; + large->next = pool->large; + pool->large = large; return p; } |