util/SliceBuffer: use C++11 initializers
This commit is contained in:
parent
11dbba3503
commit
56a9bf459d
@ -51,19 +51,19 @@ class SliceBuffer {
|
|||||||
* avoid page faulting on the new allocation, so the kernel
|
* avoid page faulting on the new allocation, so the kernel
|
||||||
* does not need to reserve physical memory pages.
|
* does not need to reserve physical memory pages.
|
||||||
*/
|
*/
|
||||||
unsigned n_initialized;
|
unsigned n_initialized = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of slices currently allocated.
|
* The number of slices currently allocated.
|
||||||
*/
|
*/
|
||||||
unsigned n_allocated;
|
unsigned n_allocated = 0;
|
||||||
|
|
||||||
Slice *const data;
|
Slice *const data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pointer to the first free element in the chain.
|
* Pointer to the first free element in the chain.
|
||||||
*/
|
*/
|
||||||
Slice *available;
|
Slice *available = nullptr;
|
||||||
|
|
||||||
size_t CalcAllocationSize() const {
|
size_t CalcAllocationSize() const {
|
||||||
return n_max * sizeof(Slice);
|
return n_max * sizeof(Slice);
|
||||||
@ -71,9 +71,8 @@ class SliceBuffer {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SliceBuffer(unsigned _count)
|
SliceBuffer(unsigned _count)
|
||||||
:n_max(_count), n_initialized(0), n_allocated(0),
|
:n_max(_count),
|
||||||
data((Slice *)HugeAllocate(CalcAllocationSize())),
|
data((Slice *)HugeAllocate(CalcAllocationSize())) {
|
||||||
available(nullptr) {
|
|
||||||
assert(n_max > 0);
|
assert(n_max > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user