diff options
author | Valentin Bartenev <vbart@nginx.com> | 2017-07-12 20:57:18 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2017-07-12 20:57:18 +0300 |
commit | 2be31e2ed643704fc51e7ae117630d8a49bcd5f8 (patch) | |
tree | 9554e2a81fe16ad10a398a74f6a22c680c4e752b /src | |
parent | 288fa854315067b66cc5926222e0bfb5942147a2 (diff) | |
download | unit-2be31e2ed643704fc51e7ae117630d8a49bcd5f8.tar.gz unit-2be31e2ed643704fc51e7ae117630d8a49bcd5f8.tar.bz2 |
Fixed style and building with NXT_DEBUG_MEMORY after 3578a7b7ace4.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_mp.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/src/nxt_mp.c b/src/nxt_mp.c index c292295c..57fe4f09 100644 --- a/src/nxt_mp.c +++ b/src/nxt_mp.c @@ -361,15 +361,13 @@ nxt_mp_alloc(nxt_mp_t *mp, size_t size) p = nxt_mp_alloc_small(mp, size); } else { + p = nxt_mp_alloc_large(mp, NXT_MAX_ALIGNMENT, size); + } -#endif +#else p = nxt_mp_alloc_large(mp, NXT_MAX_ALIGNMENT, size); -#if !(NXT_DEBUG_MEMORY) - - } - #endif nxt_debug_alloc("mp %p alloc(%uz): %p", mp, size, p); @@ -397,7 +395,6 @@ void * nxt_mp_align(nxt_mp_t *mp, size_t alignment, size_t size) { void *p; - size_t aligned_size; /* Alignment must be a power of 2. */ @@ -405,22 +402,21 @@ nxt_mp_align(nxt_mp_t *mp, size_t alignment, size_t size) #if !(NXT_DEBUG_MEMORY) + size_t aligned_size; + aligned_size = nxt_max(size, alignment); if (aligned_size <= mp->page_size && alignment <= mp->page_alignment) { - p = nxt_mp_alloc_small(mp, aligned_size); } else { + p = nxt_mp_alloc_large(mp, alignment, size); + } -#endif +#else p = nxt_mp_alloc_large(mp, alignment, size); -#if !(NXT_DEBUG_MEMORY) - - } - #endif } else { @@ -971,15 +967,13 @@ nxt_mp_nget(nxt_mp_t *mp, size_t size) p = nxt_mp_get_small(mp, &mp->nget_pages, size); } else { + p = nxt_mp_alloc_large(mp, NXT_MAX_ALIGNMENT, size); + } -#endif +#else p = nxt_mp_alloc_large(mp, NXT_MAX_ALIGNMENT, size); -#if !(NXT_DEBUG_MEMORY) - - } - #endif nxt_debug_alloc("mp %p nget(%uz): %p", mp, size, p); @@ -1000,15 +994,13 @@ nxt_mp_get(nxt_mp_t *mp, size_t size) p = nxt_mp_get_small(mp, &mp->get_pages, size); } else { + p = nxt_mp_alloc_large(mp, NXT_MAX_ALIGNMENT, size); + } -#endif +#else p = nxt_mp_alloc_large(mp, NXT_MAX_ALIGNMENT, size); -#if !(NXT_DEBUG_MEMORY) - - } - #endif nxt_debug_alloc("mp %p get(%uz): %p", mp, size, p); |