Mercurial > hg > nginx
diff src/core/ngx_alloc.c @ 26:53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 15 Dec 2002 06:25:09 +0000 |
parents | 4f3879d9b6f6 |
children | 83fa61cd3d2f |
line wrap: on
line diff
--- a/src/core/ngx_alloc.c Wed Dec 11 16:57:54 2002 +0000 +++ b/src/core/ngx_alloc.c Sun Dec 15 06:25:09 2002 +0000 @@ -3,6 +3,7 @@ #include <ngx_errno.h> #include <ngx_log.h> +#include <ngx_string.h> #include <ngx_alloc.h> @@ -15,7 +16,7 @@ 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 @@ 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 @@ 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; }