From 37afe9d0791bb196f244d317824b97f50f73e819 Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Thu, 25 Apr 2019 14:17:43 +0100 Subject: [PATCH] Clang format --- src/ds/bits.h | 4 ++-- src/mem/alloc.h | 5 +++-- src/mem/globalalloc.h | 3 ++- src/mem/largealloc.h | 4 ++-- src/mem/pagemap.h | 2 +- src/mem/pool.h | 8 +++++--- src/mem/sizeclasstable.h | 4 ++-- src/mem/superslab.h | 1 + src/mem/threadalloc.h | 2 +- src/pal/pal_apple.h | 2 +- src/pal/pal_linux.h | 2 +- 11 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/ds/bits.h b/src/ds/bits.h index 68df89e..7e2f8bc 100644 --- a/src/ds/bits.h +++ b/src/ds/bits.h @@ -453,13 +453,13 @@ namespace snmalloc } } - template + template constexpr inline T min(T t1, T t2) { return t1 < t2 ? t1 : t2; } - template + template constexpr inline T max(T t1, T t2) { return t1 > t2 ? t1 : t2; diff --git a/src/mem/alloc.h b/src/mem/alloc.h index 70d6f97..69a704b 100644 --- a/src/mem/alloc.h +++ b/src/mem/alloc.h @@ -566,7 +566,7 @@ namespace snmalloc } else if (size == PMMediumslab) { - Mediumslab * slab = Mediumslab::get(p); + Mediumslab* slab = Mediumslab::get(p); // Reading a remote sizeclass won't fail, since the other allocator // can't reuse the slab, as we have no yet deallocated this pointer. return sizeclass_to_size(slab->get_sizeclass()); @@ -792,7 +792,8 @@ namespace snmalloc } template - static uintptr_t external_pointer(void* p, uint8_t sizeclass, size_t end_point) + static uintptr_t + external_pointer(void* p, uint8_t sizeclass, size_t end_point) { size_t rsize = sizeclass_to_size(sizeclass); size_t end_point_correction = location == End ? diff --git a/src/mem/globalalloc.h b/src/mem/globalalloc.h index 5a4921a..1879e39 100644 --- a/src/mem/globalalloc.h +++ b/src/mem/globalalloc.h @@ -63,7 +63,8 @@ namespace snmalloc #else void print_all_stats(void*& o, uint64_t dumpid = 0) { - UNUSED(o); UNUSED(dumpid); + UNUSED(o); + UNUSED(dumpid); } #endif diff --git a/src/mem/largealloc.h b/src/mem/largealloc.h index 6100257..790ee00 100644 --- a/src/mem/largealloc.h +++ b/src/mem/largealloc.h @@ -68,7 +68,7 @@ namespace snmalloc error("out of memory"); PAL::template notify_using(r, OS_PAGE_SIZE); - + bump = (size_t)r; remaining = size; } @@ -167,7 +167,7 @@ namespace snmalloc auto page_end = bits::align_up((size_t)p + size, OS_PAGE_SIZE); PAL::template notify_using( - (void*)page_start, page_end - page_start); + (void*)page_start, page_end - page_start); return new (p) T(std::forward(args)...); } diff --git a/src/mem/pagemap.h b/src/mem/pagemap.h index accf6a8..a204c59 100644 --- a/src/mem/pagemap.h +++ b/src/mem/pagemap.h @@ -124,7 +124,7 @@ namespace snmalloc value, (PagemapEntry*)LOCKED_ENTRY, std::memory_order_relaxed)) { auto& v = default_memory_provider; - value = v.alloc_chunk(); + value = v.alloc_chunk(); e->store(value, std::memory_order_release); } else diff --git a/src/mem/pool.h b/src/mem/pool.h index 076caba..f49214b 100644 --- a/src/mem/pool.h +++ b/src/mem/pool.h @@ -21,7 +21,7 @@ namespace snmalloc { private: friend Pooled; - template + template friend class MemoryProviderStateMixin; std::atomic_flag lock = ATOMIC_FLAG_INIT; @@ -35,7 +35,8 @@ namespace snmalloc static Pool* make(MemoryProvider& memory_provider) noexcept { - return memory_provider.template alloc_chunk(memory_provider); + return memory_provider.template alloc_chunk( + memory_provider); } static Pool* make() noexcept @@ -52,7 +53,8 @@ namespace snmalloc return p; p = memory_provider - .template alloc_chunk(std::forward(args)...); + .template alloc_chunk( + std::forward(args)...); FlagLock f(lock); p->list_next = list; diff --git a/src/mem/sizeclasstable.h b/src/mem/sizeclasstable.h index 877c39d..fb3310a 100644 --- a/src/mem/sizeclasstable.h +++ b/src/mem/sizeclasstable.h @@ -29,8 +29,8 @@ namespace snmalloc size[sizeclass] = bits::from_exp_mant(sizeclass); - size_t alignment = - bits::min((size_t)1 << bits::ctz_const(size[sizeclass]), OS_PAGE_SIZE); + size_t alignment = bits::min( + (size_t)1 << bits::ctz_const(size[sizeclass]), OS_PAGE_SIZE); cache_friendly_mask[sizeclass] = (alignment - 1); inverse_cache_friendly_mask[sizeclass] = ~(alignment - 1); } diff --git a/src/mem/superslab.h b/src/mem/superslab.h index 1c127a6..29b49c8 100644 --- a/src/mem/superslab.h +++ b/src/mem/superslab.h @@ -3,6 +3,7 @@ #include "../ds/helpers.h" #include "allocslab.h" #include "metaslab.h" + #include namespace snmalloc diff --git a/src/mem/threadalloc.h b/src/mem/threadalloc.h index 032fa39..597c68e 100644 --- a/src/mem/threadalloc.h +++ b/src/mem/threadalloc.h @@ -8,7 +8,7 @@ #endif #if !defined(_WIN32) && !defined(FreeBSD_KERNEL) -# include "pthread.h" +# include "pthread.h" #endif namespace snmalloc diff --git a/src/pal/pal_apple.h b/src/pal/pal_apple.h index f1c92d2..eabc489 100644 --- a/src/pal/pal_apple.h +++ b/src/pal/pal_apple.h @@ -8,7 +8,7 @@ # include # include -int puts ( const char * str ); +int puts(const char* str); namespace snmalloc { diff --git a/src/pal/pal_linux.h b/src/pal/pal_linux.h index 5ded0a9..b1af854 100644 --- a/src/pal/pal_linux.h +++ b/src/pal/pal_linux.h @@ -7,7 +7,7 @@ # include # include -int puts ( const char * str ); +int puts(const char* str); namespace snmalloc {