Clang format

This commit is contained in:
Matthew Parkinson
2019-04-25 14:17:43 +01:00
committed by Matthew Parkinson
parent f88bcdbf58
commit 37afe9d079
11 changed files with 21 additions and 16 deletions

View File

@@ -453,13 +453,13 @@ namespace snmalloc
}
}
template <typename T>
template<typename T>
constexpr inline T min(T t1, T t2)
{
return t1 < t2 ? t1 : t2;
}
template <typename T>
template<typename T>
constexpr inline T max(T t1, T t2)
{
return t1 > t2 ? t1 : t2;

View File

@@ -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<Boundary location>
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 ?

View File

@@ -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

View File

@@ -68,7 +68,7 @@ namespace snmalloc
error("out of memory");
PAL::template notify_using<NoZero>(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<NoZero>(
(void*)page_start, page_end - page_start);
(void*)page_start, page_end - page_start);
return new (p) T(std::forward<Args...>(args)...);
}

View File

@@ -124,7 +124,7 @@ namespace snmalloc
value, (PagemapEntry*)LOCKED_ENTRY, std::memory_order_relaxed))
{
auto& v = default_memory_provider;
value = v.alloc_chunk<PagemapEntry,OS_PAGE_SIZE>();
value = v.alloc_chunk<PagemapEntry, OS_PAGE_SIZE>();
e->store(value, std::memory_order_release);
}
else

View File

@@ -21,7 +21,7 @@ namespace snmalloc
{
private:
friend Pooled<T>;
template <typename TT>
template<typename TT>
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<Pool,0, MemoryProvider&>(memory_provider);
return memory_provider.template alloc_chunk<Pool, 0, MemoryProvider&>(
memory_provider);
}
static Pool* make() noexcept
@@ -52,7 +53,8 @@ namespace snmalloc
return p;
p = memory_provider
.template alloc_chunk<T, bits::next_pow2_const(sizeof(T))>(std::forward<Args...>(args)...);
.template alloc_chunk<T, bits::next_pow2_const(sizeof(T))>(
std::forward<Args...>(args)...);
FlagLock f(lock);
p->list_next = list;

View File

@@ -29,8 +29,8 @@ namespace snmalloc
size[sizeclass] =
bits::from_exp_mant<INTERMEDIATE_BITS, MIN_ALLOC_BITS>(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);
}

View File

@@ -3,6 +3,7 @@
#include "../ds/helpers.h"
#include "allocslab.h"
#include "metaslab.h"
#include <new>
namespace snmalloc

View File

@@ -8,7 +8,7 @@
#endif
#if !defined(_WIN32) && !defined(FreeBSD_KERNEL)
# include "pthread.h"
# include "pthread.h"
#endif
namespace snmalloc

View File

@@ -8,7 +8,7 @@
# include <strings.h>
# include <sys/mman.h>
int puts ( const char * str );
int puts(const char* str);
namespace snmalloc
{

View File

@@ -7,7 +7,7 @@
# include <string.h>
# include <sys/mman.h>
int puts ( const char * str );
int puts(const char* str);
namespace snmalloc
{