diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/ngx_alloc.c | 8 | ||||
| -rw-r--r-- | src/core/ngx_config_command.c | 14 | ||||
| -rw-r--r-- | src/core/ngx_config_command.h | 22 | ||||
| -rw-r--r-- | src/core/ngx_core.h | 7 |
4 files changed, 46 insertions, 5 deletions
diff --git a/src/core/ngx_alloc.c b/src/core/ngx_alloc.c index 3c6b4deca..67adfcba1 100644 --- a/src/core/ngx_alloc.c +++ b/src/core/ngx_alloc.c @@ -15,7 +15,7 @@ void *ngx_alloc(size_t size, ngx_log_t *log) ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "malloc() %d bytes failed", size); - ngx_log_debug(log, "malloc: %x" _ p); + ngx_log_debug(log, "malloc: %x:%d" _ p _ size); return p; } @@ -51,10 +51,13 @@ void ngx_destroy_pool(ngx_pool_t *pool) ngx_pool_t *p, *n; ngx_pool_large_t *l; - for (l = pool->large; l; l = l->next) + for (l = pool->large; l; l = l->next) { + ngx_log_debug(pool->log, "free: %x" _ l->alloc); free(l->alloc); + } for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { + ngx_log_debug(pool->log, "free: %x" _ p); free(p); if (n == NULL) @@ -110,6 +113,7 @@ void *ngx_palloc(ngx_pool_t *pool, size_t size) if (large == NULL) { ngx_test_null(large, ngx_palloc(pool, sizeof(ngx_pool_large_t)), NULL); + large->next = NULL; } ngx_test_null(p, ngx_alloc(size, pool->log), NULL); diff --git a/src/core/ngx_config_command.c b/src/core/ngx_config_command.c new file mode 100644 index 000000000..51943021b --- /dev/null +++ b/src/core/ngx_config_command.c @@ -0,0 +1,14 @@ + +#include <ngx_config.h> + +char *ngx_conf_set_size_slot(char *conf, int offset, char *value) +{ + int size; + + size = atoi(value); + if (size < 0) + return "value must be greater or equal to zero"; + + *(int *) (conf + offset) = size; + return NULL; +} diff --git a/src/core/ngx_config_command.h b/src/core/ngx_config_command.h new file mode 100644 index 000000000..0990d44e4 --- /dev/null +++ b/src/core/ngx_config_command.h @@ -0,0 +1,22 @@ +#ifndef _NGX_HTTP_CONFIG_COMMAND_H_INCLUDED_ +#define _NGX_HTTP_CONFIG_COMMAND_H_INCLUDED_ + + +#define NGX_CONF_TAKE1 0 +#define NGX_CONF_ITERATE 0 + +#define NGX_CONF_UNSET -1 + +typedef struct { + char *name; + char *(*set)(); + int offset; + int zone; + int type; + char *description; +} ngx_command_t; + +char *ngx_conf_set_size_slot(char *conf, int offset, char *value); + + +#endif _NGX_HTTP_CONFIG_COMMAND_H_INCLUDED_ diff --git a/src/core/ngx_core.h b/src/core/ngx_core.h index 137e160d7..f3302c315 100644 --- a/src/core/ngx_core.h +++ b/src/core/ngx_core.h @@ -2,9 +2,10 @@ #define _NGX_CORE_H_INCLUDED_ -#define NGX_OK 0 -#define NGX_ERROR -1 -#define NGX_AGAIN -2 +#define NGX_OK 0 +#define NGX_ERROR -1 +#define NGX_AGAIN -2 +#define NGX_DECLINED -3 #endif /* _NGX_CORE_H_INCLUDED_ */ |
