Clang Tidy and Warnings

This commit is contained in:
Matthew Parkinson
2019-07-01 13:10:57 +01:00
parent 3c7d122dea
commit 187a016c39
3 changed files with 9 additions and 4 deletions

View File

@@ -235,6 +235,8 @@ namespace snmalloc
{
protected:
FreeListHead small_fast_free_lists[NUM_SMALL_CLASSES];
public:
FastFreeLists () : small_fast_free_lists() {}
};
/**

View File

@@ -112,7 +112,9 @@ namespace snmalloc
{
if ((size-1) <= (SLAB_SIZE-1))
{
return sizeclass_metadata.sizeclass_lookup[sizeclass_lookup_index(size)];
auto index = sizeclass_lookup_index(size);
ASSUME(index <= sizeclass_lookup_index(SLAB_SIZE));
return sizeclass_metadata.sizeclass_lookup[index];
}
// Don't use sizeclasses that are not a multiple of the alignment.

View File

@@ -48,7 +48,8 @@ namespace snmalloc
assert(sl.get_head() == (SlabLink*)((size_t)this + meta.link));
assert(!meta.is_full());
void* p;
void* p = nullptr;
bool p_has_value = false;
if (head == 1)
{
@@ -62,7 +63,7 @@ namespace snmalloc
p = pointer_offset(this, meta.link);
meta.set_full();
sl.pop();
goto finish1;
p_has_value = true;
}
else
{
@@ -104,6 +105,7 @@ namespace snmalloc
}
}
if (!p_has_value)
{
p = pointer_offset(this, meta.head);
@@ -119,7 +121,6 @@ namespace snmalloc
assert (is_start_of_object(Superslab::get(p), p));
finish1:
meta.debug_slab_invariant(is_short(), this);
if constexpr (zero_mem == YesZero)