Merge branch 'fix_decrement_typo'

Conflicts:
	include/msgpack/unpack.hpp
This commit is contained in:
Nobuyuki Kubota
2015-03-10 18:25:38 +09:00
2 changed files with 13 additions and 13 deletions

View File

@@ -335,7 +335,7 @@ public:
void set_obj(object const& obj) { m_obj = obj; }
std::size_t count() const { return m_count; }
void set_count(std::size_t count) { m_count = count; }
std::size_t decl_count() { return --m_count; }
std::size_t decr_count() { return --m_count; }
uint32_t container_type() const { return m_container_type; }
void set_container_type(uint32_t container_type) { m_container_type = container_type; }
object const& map_key() const { return m_map_key; }
@@ -352,7 +352,7 @@ inline void init_count(void* buffer)
*reinterpret_cast<volatile _msgpack_atomic_counter_t*>(buffer) = 1;
}
inline void decl_count(void* buffer)
inline void decr_count(void* buffer)
{
if(_msgpack_sync_decr_and_fetch(reinterpret_cast<volatile _msgpack_atomic_counter_t*>(buffer)) == 0) {
free(buffer);
@@ -483,7 +483,7 @@ private:
switch(sp.container_type()) {
case MSGPACK_CT_ARRAY_ITEM:
unpack_array_item(sp.obj(), obj);
if(sp.decl_count() == 0) {
if(sp.decr_count() == 0) {
obj = sp.obj();
m_stack.pop_back();
}
@@ -498,7 +498,7 @@ private:
break;
case MSGPACK_CT_MAP_VALUE:
unpack_map_item(sp.obj(), sp.map_key(), obj);
if(sp.decl_count() == 0) {
if(sp.decr_count() == 0) {
obj = sp.obj();
m_stack.pop_back();
}
@@ -1228,7 +1228,7 @@ inline unpacker& unpacker::operator=(unpacker&& other) {
inline unpacker::~unpacker()
{
// These checks are required for move operations.
if (m_buffer) detail::decl_count(m_buffer);
if (m_buffer) detail::decr_count(m_buffer);
}
@@ -1292,7 +1292,7 @@ inline void unpacker::expand_buffer(std::size_t size)
if(m_ctx.user().referenced()) {
try {
m_z->push_finalizer(&detail::decl_count, m_buffer);
m_z->push_finalizer(&detail::decr_count, m_buffer);
}
catch (...) {
::free(tmp);
@@ -1300,7 +1300,7 @@ inline void unpacker::expand_buffer(std::size_t size)
}
m_ctx.user().set_referenced(false);
} else {
detail::decl_count(m_buffer);
detail::decr_count(m_buffer);
}
m_buffer = tmp;
@@ -1410,7 +1410,7 @@ inline bool unpacker::flush_zone()
{
if(m_ctx.user().referenced()) {
try {
m_z->push_finalizer(&detail::decl_count, m_buffer);
m_z->push_finalizer(&detail::decr_count, m_buffer);
} catch (...) {
return false;
}

View File

@@ -287,7 +287,7 @@ static inline void init_count(void* buffer)
*(volatile _msgpack_atomic_counter_t*)buffer = 1;
}
static inline void decl_count(void* buffer)
static inline void decr_count(void* buffer)
{
// atomic if(--*(_msgpack_atomic_counter_t*)buffer == 0) { free(buffer); }
if(_msgpack_sync_decr_and_fetch((volatile _msgpack_atomic_counter_t*)buffer) == 0) {
@@ -354,7 +354,7 @@ void msgpack_unpacker_destroy(msgpack_unpacker* mpac)
{
msgpack_zone_free(mpac->z);
free(mpac->ctx);
decl_count(mpac->buffer);
decr_count(mpac->buffer);
}
@@ -434,13 +434,13 @@ bool msgpack_unpacker_expand_buffer(msgpack_unpacker* mpac, size_t size)
memcpy(tmp+COUNTER_SIZE, mpac->buffer+mpac->off, not_parsed);
if(CTX_REFERENCED(mpac)) {
if(!msgpack_zone_push_finalizer(mpac->z, decl_count, mpac->buffer)) {
if(!msgpack_zone_push_finalizer(mpac->z, decr_count, mpac->buffer)) {
free(tmp);
return false;
}
CTX_REFERENCED(mpac) = false;
} else {
decl_count(mpac->buffer);
decr_count(mpac->buffer);
}
mpac->buffer = tmp;
@@ -494,7 +494,7 @@ void msgpack_unpacker_reset_zone(msgpack_unpacker* mpac)
bool msgpack_unpacker_flush_zone(msgpack_unpacker* mpac)
{
if(CTX_REFERENCED(mpac)) {
if(!msgpack_zone_push_finalizer(mpac->z, decl_count, mpac->buffer)) {
if(!msgpack_zone_push_finalizer(mpac->z, decr_count, mpac->buffer)) {
return false;
}
CTX_REFERENCED(mpac) = false;