mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-04-27 18:30:53 +02:00
Fixed typo.
Replaced 'decl' with 'decr'.
This commit is contained in:
parent
f6d0cd9a4b
commit
82a10cba5c
@ -335,7 +335,7 @@ public:
|
|||||||
void set_obj(object const& obj) { m_obj = obj; }
|
void set_obj(object const& obj) { m_obj = obj; }
|
||||||
std::size_t count() const { return m_count; }
|
std::size_t count() const { return m_count; }
|
||||||
void set_count(std::size_t count) { m_count = 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; }
|
uint32_t container_type() const { return m_container_type; }
|
||||||
void set_container_type(uint32_t container_type) { m_container_type = container_type; }
|
void set_container_type(uint32_t container_type) { m_container_type = container_type; }
|
||||||
object const& map_key() const { return m_map_key; }
|
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;
|
*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) {
|
if(_msgpack_sync_decr_and_fetch(reinterpret_cast<volatile _msgpack_atomic_counter_t*>(buffer)) == 0) {
|
||||||
free(buffer);
|
free(buffer);
|
||||||
@ -489,7 +489,7 @@ private:
|
|||||||
switch(sp->container_type()) {
|
switch(sp->container_type()) {
|
||||||
case CT_ARRAY_ITEM:
|
case CT_ARRAY_ITEM:
|
||||||
unpack_array_item(sp->obj(), obj);
|
unpack_array_item(sp->obj(), obj);
|
||||||
if(sp->decl_count() == 0) {
|
if(sp->decr_count() == 0) {
|
||||||
obj = sp->obj();
|
obj = sp->obj();
|
||||||
--m_top;
|
--m_top;
|
||||||
/*printf("stack pop %d\n", m_top);*/
|
/*printf("stack pop %d\n", m_top);*/
|
||||||
@ -505,7 +505,7 @@ private:
|
|||||||
break;
|
break;
|
||||||
case CT_MAP_VALUE:
|
case CT_MAP_VALUE:
|
||||||
unpack_map_item(sp->obj(), sp->map_key(), obj);
|
unpack_map_item(sp->obj(), sp->map_key(), obj);
|
||||||
if(sp->decl_count() == 0) {
|
if(sp->decr_count() == 0) {
|
||||||
obj = sp->obj();
|
obj = sp->obj();
|
||||||
--m_top;
|
--m_top;
|
||||||
/*printf("stack pop %d\n", m_top);*/
|
/*printf("stack pop %d\n", m_top);*/
|
||||||
@ -1239,7 +1239,7 @@ inline unpacker& unpacker::operator=(unpacker&& other) {
|
|||||||
inline unpacker::~unpacker()
|
inline unpacker::~unpacker()
|
||||||
{
|
{
|
||||||
// These checks are required for move operations.
|
// These checks are required for move operations.
|
||||||
if (m_buffer) detail::decl_count(m_buffer);
|
if (m_buffer) detail::decr_count(m_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1303,7 +1303,7 @@ inline void unpacker::expand_buffer(std::size_t size)
|
|||||||
|
|
||||||
if(m_ctx.user().referenced()) {
|
if(m_ctx.user().referenced()) {
|
||||||
try {
|
try {
|
||||||
m_z->push_finalizer(&detail::decl_count, m_buffer);
|
m_z->push_finalizer(&detail::decr_count, m_buffer);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
::free(tmp);
|
::free(tmp);
|
||||||
@ -1311,7 +1311,7 @@ inline void unpacker::expand_buffer(std::size_t size)
|
|||||||
}
|
}
|
||||||
m_ctx.user().set_referenced(false);
|
m_ctx.user().set_referenced(false);
|
||||||
} else {
|
} else {
|
||||||
detail::decl_count(m_buffer);
|
detail::decr_count(m_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_buffer = tmp;
|
m_buffer = tmp;
|
||||||
@ -1421,7 +1421,7 @@ inline bool unpacker::flush_zone()
|
|||||||
{
|
{
|
||||||
if(m_ctx.user().referenced()) {
|
if(m_ctx.user().referenced()) {
|
||||||
try {
|
try {
|
||||||
m_z->push_finalizer(&detail::decl_count, m_buffer);
|
m_z->push_finalizer(&detail::decr_count, m_buffer);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
10
src/unpack.c
10
src/unpack.c
@ -287,7 +287,7 @@ static inline void init_count(void* buffer)
|
|||||||
*(volatile _msgpack_atomic_counter_t*)buffer = 1;
|
*(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); }
|
// atomic if(--*(_msgpack_atomic_counter_t*)buffer == 0) { free(buffer); }
|
||||||
if(_msgpack_sync_decr_and_fetch((volatile _msgpack_atomic_counter_t*)buffer) == 0) {
|
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);
|
msgpack_zone_free(mpac->z);
|
||||||
free(mpac->ctx);
|
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);
|
memcpy(tmp+COUNTER_SIZE, mpac->buffer+mpac->off, not_parsed);
|
||||||
|
|
||||||
if(CTX_REFERENCED(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)) {
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CTX_REFERENCED(mpac) = false;
|
CTX_REFERENCED(mpac) = false;
|
||||||
} else {
|
} else {
|
||||||
decl_count(mpac->buffer);
|
decr_count(mpac->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
mpac->buffer = tmp;
|
mpac->buffer = tmp;
|
||||||
@ -494,7 +494,7 @@ void msgpack_unpacker_reset_zone(msgpack_unpacker* mpac)
|
|||||||
bool msgpack_unpacker_flush_zone(msgpack_unpacker* mpac)
|
bool msgpack_unpacker_flush_zone(msgpack_unpacker* mpac)
|
||||||
{
|
{
|
||||||
if(CTX_REFERENCED(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;
|
return false;
|
||||||
}
|
}
|
||||||
CTX_REFERENCED(mpac) = false;
|
CTX_REFERENCED(mpac) = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user