From 0528f2407aa79da94a92cac5a0fdd50a93eb5e1e Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 23 Nov 2009 11:56:44 +0100 Subject: Introduced type matchers. --- src/shared/cplusplus/MemoryPool.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/shared/cplusplus/MemoryPool.cpp') diff --git a/src/shared/cplusplus/MemoryPool.cpp b/src/shared/cplusplus/MemoryPool.cpp index 1453c62cd6..4e0004f0a1 100644 --- a/src/shared/cplusplus/MemoryPool.cpp +++ b/src/shared/cplusplus/MemoryPool.cpp @@ -47,14 +47,11 @@ // THE SOFTWARE. #include "MemoryPool.h" -#include #include #include using namespace CPlusPlus; -using namespace std; - MemoryPool::MemoryPool() : _initializeAllocatedMemory(true), _blocks(0), @@ -68,12 +65,12 @@ MemoryPool::~MemoryPool() { if (_blockCount != -1) { for (int i = 0; i < _blockCount + 1; ++i) { - free(_blocks[i]); + std::free(_blocks[i]); } } if (_blocks) - free(_blocks); + std::free(_blocks); } bool MemoryPool::initializeAllocatedMemory() const @@ -98,9 +95,9 @@ void *MemoryPool::allocate_helper(size_t size) char *&block = _blocks[_blockCount]; if (_initializeAllocatedMemory) - block = (char *) calloc(1, BLOCK_SIZE); + block = (char *) std::calloc(1, BLOCK_SIZE); else - block = (char *) malloc(BLOCK_SIZE); + block = (char *) std::malloc(BLOCK_SIZE); ptr = block; end = ptr + BLOCK_SIZE; @@ -117,7 +114,7 @@ void MemoryPool::rewind(const State &state) { if (_blockCount == state.blockCount && state.ptr < ptr) { if (_initializeAllocatedMemory) - memset(state.ptr, '\0', ptr - state.ptr); + std::memset(state.ptr, '\0', ptr - state.ptr); ptr = state.ptr; } -- cgit v1.2.1