summaryrefslogtreecommitdiff
path: root/cpp/zone.cpp
diff options
context:
space:
mode:
authorfrsyuki <frsyuki@5a5092ae-2292-43ba-b2d5-dcab9c1a2731>2009-02-15 09:09:58 +0000
committerfrsyuki <frsyuki@5a5092ae-2292-43ba-b2d5-dcab9c1a2731>2009-02-15 09:09:58 +0000
commit31659738110f7d73d8fd4fe2d6fc62991ac7912f (patch)
tree3296e710cb71a4414fa04e406878a943aa37c292 /cpp/zone.cpp
parenta7936ba05b15ec7a19e8dc75667fec2df13b7ea7 (diff)
downloadmsgpack-python-31659738110f7d73d8fd4fe2d6fc62991ac7912f.tar.gz
lang/c/msgpack: fix compile optimization flag
git-svn-id: file:///Users/frsyuki/project/msgpack-git/svn/x@70 5a5092ae-2292-43ba-b2d5-dcab9c1a2731
Diffstat (limited to 'cpp/zone.cpp')
-rw-r--r--cpp/zone.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/cpp/zone.cpp b/cpp/zone.cpp
index 490bc25..527cc9c 100644
--- a/cpp/zone.cpp
+++ b/cpp/zone.cpp
@@ -20,10 +20,6 @@
namespace msgpack {
-zone::zone() { }
-
-zone::~zone() { clear(); }
-
void zone::clear()
{
for(std::vector<char*>::iterator it(m_ptrs.begin()), it_end(m_ptrs.end());
@@ -33,22 +29,18 @@ void zone::clear()
m_ptrs.clear();
}
-char* zone::realloc(char* ptr, size_t count)
+char* zone::realloc_real(char* ptr, size_t count)
{
- if(ptr == NULL) {
- return zone::malloc(count);
- } else {
- for(std::vector<char*>::reverse_iterator it(m_ptrs.rbegin()), it_end(m_ptrs.rend());
- it != it_end; ++it) {
- if(*it == ptr) {
- char* tmp = (char*)::realloc(ptr, count);
- if(!tmp) { throw std::bad_alloc(); }
- *it = tmp;
- return tmp;
- }
+ for(std::vector<char*>::reverse_iterator it(m_ptrs.rbegin()), it_end(m_ptrs.rend());
+ it != it_end; ++it) {
+ if(*it == ptr) {
+ char* tmp = (char*)::realloc(ptr, count);
+ if(!tmp) { throw std::bad_alloc(); }
+ *it = tmp;
+ return tmp;
}
- throw std::bad_alloc();
}
+ throw std::bad_alloc();
}