Skip to content

Commit cf1487f

Browse files
committed
Merge branch 'fix_decrement_typo'
Conflicts: include/msgpack/unpack.hpp
2 parents e4cd479 + 82a10cb commit cf1487f

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

include/msgpack/unpack.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ class unpack_stack {
335335
void set_obj(object const& obj) { m_obj = obj; }
336336
std::size_t count() const { return m_count; }
337337
void set_count(std::size_t count) { m_count = count; }
338-
std::size_t decl_count() { return --m_count; }
338+
std::size_t decr_count() { return --m_count; }
339339
uint32_t container_type() const { return m_container_type; }
340340
void set_container_type(uint32_t container_type) { m_container_type = container_type; }
341341
object const& map_key() const { return m_map_key; }
@@ -352,7 +352,7 @@ inline void init_count(void* buffer)
352352
*reinterpret_cast<volatile _msgpack_atomic_counter_t*>(buffer) = 1;
353353
}
354354

355-
inline void decl_count(void* buffer)
355+
inline void decr_count(void* buffer)
356356
{
357357
if(_msgpack_sync_decr_and_fetch(reinterpret_cast<volatile _msgpack_atomic_counter_t*>(buffer)) == 0) {
358358
free(buffer);
@@ -483,7 +483,7 @@ class context {
483483
switch(sp.container_type()) {
484484
case MSGPACK_CT_ARRAY_ITEM:
485485
unpack_array_item(sp.obj(), obj);
486-
if(sp.decl_count() == 0) {
486+
if(sp.decr_count() == 0) {
487487
obj = sp.obj();
488488
m_stack.pop_back();
489489
}
@@ -498,7 +498,7 @@ class context {
498498
break;
499499
case MSGPACK_CT_MAP_VALUE:
500500
unpack_map_item(sp.obj(), sp.map_key(), obj);
501-
if(sp.decl_count() == 0) {
501+
if(sp.decr_count() == 0) {
502502
obj = sp.obj();
503503
m_stack.pop_back();
504504
}
@@ -1228,7 +1228,7 @@ inline unpacker& unpacker::operator=(unpacker&& other) {
12281228
inline unpacker::~unpacker()
12291229
{
12301230
// These checks are required for move operations.
1231-
if (m_buffer) detail::decl_count(m_buffer);
1231+
if (m_buffer) detail::decr_count(m_buffer);
12321232
}
12331233

12341234

@@ -1292,15 +1292,15 @@ inline void unpacker::expand_buffer(std::size_t size)
12921292

12931293
if(m_ctx.user().referenced()) {
12941294
try {
1295-
m_z->push_finalizer(&detail::decl_count, m_buffer);
1295+
m_z->push_finalizer(&detail::decr_count, m_buffer);
12961296
}
12971297
catch (...) {
12981298
::free(tmp);
12991299
throw;
13001300
}
13011301
m_ctx.user().set_referenced(false);
13021302
} else {
1303-
detail::decl_count(m_buffer);
1303+
detail::decr_count(m_buffer);
13041304
}
13051305

13061306
m_buffer = tmp;
@@ -1410,7 +1410,7 @@ inline bool unpacker::flush_zone()
14101410
{
14111411
if(m_ctx.user().referenced()) {
14121412
try {
1413-
m_z->push_finalizer(&detail::decl_count, m_buffer);
1413+
m_z->push_finalizer(&detail::decr_count, m_buffer);
14141414
} catch (...) {
14151415
return false;
14161416
}

src/unpack.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ static inline void init_count(void* buffer)
287287
*(volatile _msgpack_atomic_counter_t*)buffer = 1;
288288
}
289289

290-
static inline void decl_count(void* buffer)
290+
static inline void decr_count(void* buffer)
291291
{
292292
// atomic if(--*(_msgpack_atomic_counter_t*)buffer == 0) { free(buffer); }
293293
if(_msgpack_sync_decr_and_fetch((volatile _msgpack_atomic_counter_t*)buffer) == 0) {
@@ -354,7 +354,7 @@ void msgpack_unpacker_destroy(msgpack_unpacker* mpac)
354354
{
355355
msgpack_zone_free(mpac->z);
356356
free(mpac->ctx);
357-
decl_count(mpac->buffer);
357+
decr_count(mpac->buffer);
358358
}
359359

360360

@@ -434,13 +434,13 @@ bool msgpack_unpacker_expand_buffer(msgpack_unpacker* mpac, size_t size)
434434
memcpy(tmp+COUNTER_SIZE, mpac->buffer+mpac->off, not_parsed);
435435

436436
if(CTX_REFERENCED(mpac)) {
437-
if(!msgpack_zone_push_finalizer(mpac->z, decl_count, mpac->buffer)) {
437+
if(!msgpack_zone_push_finalizer(mpac->z, decr_count, mpac->buffer)) {
438438
free(tmp);
439439
return false;
440440
}
441441
CTX_REFERENCED(mpac) = false;
442442
} else {
443-
decl_count(mpac->buffer);
443+
decr_count(mpac->buffer);
444444
}
445445

446446
mpac->buffer = tmp;
@@ -494,7 +494,7 @@ void msgpack_unpacker_reset_zone(msgpack_unpacker* mpac)
494494
bool msgpack_unpacker_flush_zone(msgpack_unpacker* mpac)
495495
{
496496
if(CTX_REFERENCED(mpac)) {
497-
if(!msgpack_zone_push_finalizer(mpac->z, decl_count, mpac->buffer)) {
497+
if(!msgpack_zone_push_finalizer(mpac->z, decr_count, mpac->buffer)) {
498498
return false;
499499
}
500500
CTX_REFERENCED(mpac) = false;

0 commit comments

Comments
 (0)