Fix global variable initialization for linker

Linker now calls init functions for itself.

(cherry picked from commit 4151ea73b7)

Change-Id: I3300fe22de8ad8466a5b1c2d551429769a42852d
This commit is contained in:
Dmitriy Ivanov
2014-07-24 15:33:25 -07:00
parent 34b258dd69
commit 6554996948
4 changed files with 7 additions and 21 deletions

View File

@@ -28,17 +28,12 @@ struct FreeBlockInfo {
size_t num_free_blocks;
};
LinkerBlockAllocator::LinkerBlockAllocator()
: block_size_(0),
LinkerBlockAllocator::LinkerBlockAllocator(size_t block_size)
: block_size_(block_size < sizeof(FreeBlockInfo) ? sizeof(FreeBlockInfo) : block_size),
page_list_(nullptr),
free_block_list_(nullptr)
{}
void LinkerBlockAllocator::init(size_t block_size) {
block_size_ = block_size < sizeof(FreeBlockInfo) ? sizeof(FreeBlockInfo) : block_size;
}
void* LinkerBlockAllocator::alloc() {
if (free_block_list_ == nullptr) {
create_new_page();