diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/nginx.c | 2 | ||||
| -rw-r--r-- | src/core/ngx_alloc.c | 24 | ||||
| -rw-r--r-- | src/core/ngx_config.h | 6 | ||||
| -rw-r--r-- | src/core/ngx_config_file.h | 4 |
4 files changed, 29 insertions, 7 deletions
diff --git a/src/core/nginx.c b/src/core/nginx.c index 17a3d10c3..3d2d4403f 100644 --- a/src/core/nginx.c +++ b/src/core/nginx.c @@ -56,7 +56,7 @@ int main(int argc, char *const *argv) /* TODO: read config */ -#if 1 +#if 0 ngx_memzero(&conf, sizeof(ngx_conf_t)); ngx_test_null(conf.args, ngx_create_array(ngx_pool, 10, sizeof(ngx_str_t)), 1); diff --git a/src/core/ngx_alloc.c b/src/core/ngx_alloc.c index 36ad505b5..26c7458a1 100644 --- a/src/core/ngx_alloc.c +++ b/src/core/ngx_alloc.c @@ -12,11 +12,14 @@ void *ngx_alloc(size_t size, ngx_log_t *log) void *p; p = malloc(size); - if (p == NULL) + if (p == NULL) { ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "malloc() %d bytes failed", size); + } +#if (NGX_DEBUG_ALLOC) ngx_log_debug(log, "malloc: %08x:%d" _ p _ size); +#endif return p; } @@ -26,8 +29,9 @@ void *ngx_calloc(size_t size, ngx_log_t *log) void *p; p = ngx_alloc(size, log); - if (p) + if (p) { ngx_memzero(p, size); + } return p; } @@ -53,16 +57,21 @@ void ngx_destroy_pool(ngx_pool_t *pool) ngx_pool_large_t *l; for (l = pool->large; l; l = l->next) { +#if (NGX_DEBUG_ALLOC) ngx_log_debug(pool->log, "free: %08x" _ l->alloc); +#endif free(l->alloc); } for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { +#if (NGX_DEBUG_ALLOC) ngx_log_debug(pool->log, "free: %08x" _ p); +#endif free(p); - if (n == NULL) + if (n == NULL) { break; + } } } @@ -83,8 +92,9 @@ void *ngx_palloc(ngx_pool_t *pool, size_t size) return m; } - if (n == NULL) + if (n == NULL) { break; + } } /* alloc new pool block */ @@ -107,8 +117,9 @@ void *ngx_palloc(ngx_pool_t *pool, size_t size) break; } - if (last->next == NULL) + if (last->next == NULL) { break; + } } } @@ -138,8 +149,9 @@ void *ngx_pcalloc(ngx_pool_t *pool, size_t size) void *p; p = ngx_palloc(pool, size); - if (p) + if (p) { ngx_memzero(p, size); + } return p; } diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h index 51d59dac1..2797a8df3 100644 --- a/src/core/ngx_config.h +++ b/src/core/ngx_config.h @@ -99,6 +99,12 @@ */ #endif + +#if (HAVE_DEVPOLL) +#include <sys/devpoll.h> /* Solaris, HP/UX */ +#endif + + #define ngx_inline inline diff --git a/src/core/ngx_config_file.h b/src/core/ngx_config_file.h index 341668a9a..7ba7621f8 100644 --- a/src/core/ngx_config_file.h +++ b/src/core/ngx_config_file.h @@ -53,6 +53,10 @@ typedef struct { char *description; } ngx_command_t; + +int ngx_conf_read_token(ngx_conf_t *cf); + + char *ngx_conf_set_size_slot(char *conf, int offset, char *value); char *ngx_conf_set_time_slot(char *conf, int offset, char *value); |
