From 2be31e2ed643704fc51e7ae117630d8a49bcd5f8 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Wed, 12 Jul 2017 20:57:18 +0300 Subject: Fixed style and building with NXT_DEBUG_MEMORY after 3578a7b7ace4. --- src/nxt_mp.c | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) (limited to 'src/nxt_mp.c') 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); -- cgit