diff options
author | Igor Sysoev <igor@sysoev.ru> | 2002-12-15 06:25:09 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2002-12-15 06:25:09 +0000 |
commit | 42feecbdb694e114e034f0be67d19bba4165c363 (patch) | |
tree | aea7c9c7c12f3cfef321901ddf92846815f1b876 /src/core/ngx_alloc.c | |
parent | 3add464b545b5dd29d07873b84f90fb77021d0c4 (diff) | |
download | nginx-42feecbdb694e114e034f0be67d19bba4165c363.tar.gz nginx-42feecbdb694e114e034f0be67d19bba4165c363.zip |
nginx-0.0.1-2002-12-15-09:25:09 import
Diffstat (limited to 'src/core/ngx_alloc.c')
-rw-r--r-- | src/core/ngx_alloc.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/ngx_alloc.c b/src/core/ngx_alloc.c index 67adfcba1..36ad505b5 100644 --- a/src/core/ngx_alloc.c +++ b/src/core/ngx_alloc.c @@ -3,6 +3,7 @@ #include <ngx_errno.h> #include <ngx_log.h> +#include <ngx_string.h> #include <ngx_alloc.h> @@ -15,7 +16,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:%d" _ p _ size); + ngx_log_debug(log, "malloc: %08x:%d" _ p _ size); return p; } @@ -52,12 +53,12 @@ void ngx_destroy_pool(ngx_pool_t *pool) ngx_pool_large_t *l; for (l = pool->large; l; l = l->next) { - ngx_log_debug(pool->log, "free: %x" _ l->alloc); + ngx_log_debug(pool->log, "free: %08x" _ 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); + ngx_log_debug(pool->log, "free: %08x" _ p); free(p); if (n == NULL) @@ -74,9 +75,10 @@ void *ngx_palloc(ngx_pool_t *pool, size_t size) if (size <= NGX_MAX_ALLOC_FROM_POOL) { for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { - if ((size_t) (p->end - p->last) >= size) { - m = p->last; - p->last += size; + if ((size_t) (p->end - ngx_align(p->last)) >= size) { + m = ngx_align(p->last); + p->last = ngx_align(p->last); + p->last += size ; return m; } |