mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-07 18:29:53 +00:00
lang/c/msgpack: fix compile optimization flag
git-svn-id: file:///Users/frsyuki/project/msgpack-git/svn/x@70 5a5092ae-2292-43ba-b2d5-dcab9c1a2731
This commit is contained in:
parent
a7936ba05b
commit
3165973811
9 changed files with 80 additions and 43 deletions
26
cpp/zone.cpp
26
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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue