From bad94e80d3b2362728dc65cbc1d573c3fc2394dc Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Tue, 4 Feb 2020 10:24:57 +0000 Subject: [PATCH] Clangformat --- src/mem/alloc.h | 3 +-- src/mem/largealloc.h | 11 ++++++----- src/mem/slab.h | 4 ++-- src/mem/superslab.h | 5 +++-- src/override/malloc.cc | 3 +-- src/pal/pal_posix.h | 1 - src/test/func/malloc/malloc.cc | 3 ++- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/mem/alloc.h b/src/mem/alloc.h index 8d1ae12..76434e6 100644 --- a/src/mem/alloc.h +++ b/src/mem/alloc.h @@ -1070,8 +1070,7 @@ namespace snmalloc bool was_full = super->is_full(); SlabList* sl = &small_classes[sizeclass]; Slab* slab = Metaslab::get_slab(p); - Superslab::Action a = - slab->dealloc_slow(sl, super, p); + Superslab::Action a = slab->dealloc_slow(sl, super, p); if (likely(a == Superslab::NoSlabReturn)) return; stats().sizeclass_dealloc_slab(sizeclass); diff --git a/src/mem/largealloc.h b/src/mem/largealloc.h index 9abc35a..6e0f41b 100644 --- a/src/mem/largealloc.h +++ b/src/mem/largealloc.h @@ -124,7 +124,7 @@ namespace snmalloc void push_space(address_t start, size_t large_class) { - void * p = pointer_cast(start); + void* p = pointer_cast(start); if (large_class > 0) PAL::template notify_using(p, OS_PAGE_SIZE); else @@ -249,7 +249,7 @@ namespace snmalloc PAL::notify_not_using(pointer_cast(end), p1 - end); } - for (; end < bits::align_down(p1,align); end += size) + for (; end < bits::align_down(p1, align); end += size) { push_space(end, large_class); } @@ -409,13 +409,14 @@ namespace snmalloc } // Cross-reference largealloc's alloc() decommitted condition. - if ((decommit_strategy != DecommitNone) - && (large_class != 0 || decommit_strategy == DecommitSuper)) + if ( + (decommit_strategy != DecommitNone) && + (large_class != 0 || decommit_strategy == DecommitSuper)) { size_t rsize = bits::one_at_bit(SUPERSLAB_BITS) << large_class; memory_provider.notify_not_using( - pointer_offset(p, OS_PAGE_SIZE), rsize - OS_PAGE_SIZE); + pointer_offset(p, OS_PAGE_SIZE), rsize - OS_PAGE_SIZE); } stats.superslab_push(); diff --git a/src/mem/slab.h b/src/mem/slab.h index ce71f76..00058ae 100644 --- a/src/mem/slab.h +++ b/src/mem/slab.h @@ -178,8 +178,8 @@ namespace snmalloc // This does not need to remove the "use" as done by the fast path. // Returns a complex return code for managing the superslab meta data. // i.e. This deallocation could make an entire superslab free. - SNMALLOC_SLOW_PATH typename Superslab::Action dealloc_slow( - SlabList* sl, Superslab* super, void* p) + SNMALLOC_SLOW_PATH typename Superslab::Action + dealloc_slow(SlabList* sl, Superslab* super, void* p) { Metaslab& meta = super->get_meta(this); diff --git a/src/mem/superslab.h b/src/mem/superslab.h index b0a036a..8e3a7fc 100644 --- a/src/mem/superslab.h +++ b/src/mem/superslab.h @@ -84,7 +84,7 @@ namespace snmalloc { if (kind != Fresh) { - // If this wasn't previously Fresh, we need to zero some things. + // If this wasn't previously Fresh, we need to zero some things. used = 0; for (size_t i = 0; i < SLAB_COUNT; i++) { @@ -105,7 +105,8 @@ namespace snmalloc { curr = (curr + meta[curr].next + 1) & (SLAB_COUNT - 1); } - if (curr != 0) abort(); + if (curr != 0) + abort(); for (size_t i = 0; i < SLAB_COUNT; i++) { diff --git a/src/override/malloc.cc b/src/override/malloc.cc index caa7706..9c238d3 100644 --- a/src/override/malloc.cc +++ b/src/override/malloc.cc @@ -107,8 +107,7 @@ extern "C" SNMALLOC_EXPORT void* SNMALLOC_NAME_MANGLE(memalign)(size_t alignment, size_t size) { - if ( - (alignment == 0) || (alignment == size_t(-1))) + if ((alignment == 0) || (alignment == size_t(-1))) { errno = EINVAL; return nullptr; diff --git a/src/pal/pal_posix.h b/src/pal/pal_posix.h index 680c49c..c2097a3 100644 --- a/src/pal/pal_posix.h +++ b/src/pal/pal_posix.h @@ -83,7 +83,6 @@ namespace snmalloc UNUSED(p); UNUSED(size); #endif - } /** diff --git a/src/test/func/malloc/malloc.cc b/src/test/func/malloc/malloc.cc index b0b5846..3ed01ed 100644 --- a/src/test/func/malloc/malloc.cc +++ b/src/test/func/malloc/malloc.cc @@ -108,7 +108,8 @@ int main(int argc, char** argv) test_posix_memalign((size_t)-1, 0, EINVAL, true); test_posix_memalign(OS_PAGE_SIZE, sizeof(uintptr_t) / 2, EINVAL, true); - for (size_t align = sizeof(uintptr_t); align <= SUPERSLAB_SIZE * 8; align <<= 1) + for (size_t align = sizeof(uintptr_t); align <= SUPERSLAB_SIZE * 8; + align <<= 1) { for (snmalloc::sizeclass_t sc = 0; sc < NUM_SIZECLASSES; sc++) {