From ce36d0c82601eedce03eca220ea65a1b3827ab9c Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sun, 7 Apr 2019 05:30:07 -0400 Subject: [PATCH] split out allocate_large function --- h_malloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/h_malloc.c b/h_malloc.c index ad00b82..fec0d5c 100644 --- a/h_malloc.c +++ b/h_malloc.c @@ -1127,11 +1127,7 @@ static size_t get_guard_size(struct random_state *state, size_t size) { return (get_random_u64_uniform(state, size / PAGE_SIZE / GUARD_SIZE_DIVISOR) + 1) * PAGE_SIZE; } -static void *allocate(size_t size) { - if (size <= max_slab_size_class) { - return allocate_small(size); - } - +static void *allocate_large(size_t size) { struct region_allocator *ra = ro.region_allocator; mutex_lock(&ra->lock); @@ -1157,6 +1153,10 @@ static void *allocate(size_t size) { return p; } +static inline void *allocate(size_t size) { + return size <= max_slab_size_class ? allocate_small(size) : allocate_large(size); +} + static void deallocate_large(void *p, const size_t *expected_size) { enforce_init(); thread_unseal_metadata();