aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-07-12 23:53:30 +0000
committerlloyd <[email protected]>2011-07-12 23:53:30 +0000
commit851f8d1535be56679f7779c3382184608fe11c7b (patch)
tree831f1b6b575e79e50be51455b779a4627076ce2d /src/alloc
parent872725373844c6f364507c9ed994cc5396ee5fd0 (diff)
Use nullptr
Diffstat (limited to 'src/alloc')
-rw-r--r--src/alloc/alloc_mmap/mmap_mem.cpp2
-rw-r--r--src/alloc/mem_pool/mem_pool.cpp12
2 files changed, 7 insertions, 7 deletions
diff --git a/src/alloc/alloc_mmap/mmap_mem.cpp b/src/alloc/alloc_mmap/mmap_mem.cpp
index e4b602764..bdc3fcab9 100644
--- a/src/alloc/alloc_mmap/mmap_mem.cpp
+++ b/src/alloc/alloc_mmap/mmap_mem.cpp
@@ -123,7 +123,7 @@ void* MemoryMapping_Allocator::alloc_block(size_t n)
*/
void MemoryMapping_Allocator::dealloc_block(void* ptr, size_t n)
{
- if(ptr == 0)
+ if(ptr == nullptr)
return;
const byte PATTERNS[] = { 0x00, 0xF5, 0x5A, 0xAF, 0x00 };
diff --git a/src/alloc/mem_pool/mem_pool.cpp b/src/alloc/mem_pool/mem_pool.cpp
index 92515e5b2..770622149 100644
--- a/src/alloc/mem_pool/mem_pool.cpp
+++ b/src/alloc/mem_pool/mem_pool.cpp
@@ -46,7 +46,7 @@ byte* Pooling_Allocator::Memory_Block::alloc(size_t n)
if(n == BITMAP_SIZE)
{
if(bitmap)
- return 0;
+ return nullptr;
else
{
bitmap = ~bitmap;
@@ -69,7 +69,7 @@ byte* Pooling_Allocator::Memory_Block::alloc(size_t n)
}
if(bitmap & mask)
- return 0;
+ return nullptr;
bitmap |= mask;
return buffer + offset * BLOCK_SIZE;
@@ -166,7 +166,7 @@ void Pooling_Allocator::deallocate(void* ptr, size_t n)
const size_t BITMAP_SIZE = Memory_Block::bitmap_size();
const size_t BLOCK_SIZE = Memory_Block::block_size();
- if(ptr == 0 && n == 0)
+ if(ptr == nullptr && n == 0)
return;
std::lock_guard<std::mutex> lock(mutex);
@@ -193,7 +193,7 @@ void Pooling_Allocator::deallocate(void* ptr, size_t n)
byte* Pooling_Allocator::allocate_blocks(size_t n)
{
if(blocks.empty())
- return 0;
+ return nullptr;
auto i = last_used;
@@ -212,7 +212,7 @@ byte* Pooling_Allocator::allocate_blocks(size_t n)
}
while(i != last_used);
- return 0;
+ return nullptr;
}
/*
@@ -232,7 +232,7 @@ void Pooling_Allocator::get_more_core(size_t in_bytes)
const size_t to_allocate = in_blocks * TOTAL_BLOCK_SIZE;
void* ptr = alloc_block(to_allocate);
- if(ptr == 0)
+ if(ptr == nullptr)
throw Memory_Exhaustion();
allocated.push_back(std::make_pair(ptr, to_allocate));