diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/algo_factory/algo_cache.h | 2 | ||||
-rw-r--r-- | src/alloc/alloc_mmap/mmap_mem.cpp | 2 | ||||
-rw-r--r-- | src/alloc/mem_pool/mem_pool.cpp | 12 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/algo_factory/algo_cache.h b/src/algo_factory/algo_cache.h index 56329024a..3a792c994 100644 --- a/src/algo_factory/algo_cache.h +++ b/src/algo_factory/algo_cache.h @@ -138,7 +138,7 @@ const T* Algorithm_Cache<T>::get(const std::string& algo_spec, if(prov_name == pref_provider) return i->second; - if(prototype == 0 || prov_weight > prototype_prov_weight) + if(prototype == nullptr || prov_weight > prototype_prov_weight) { prototype = i->second; prototype_provider = i->first; 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)); |