summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/nxt_mp.c36
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);