Skip to content

Commit 82a10cb

Browse files
committed
Fixed typo.
Replaced 'decl' with 'decr'.
1 parent f6d0cd9 commit 82a10cb

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);
@@ -489,7 +489,7 @@ class context {
489489
switch(sp->container_type()) {
490490
case CT_ARRAY_ITEM:
491491
unpack_array_item(sp->obj(), obj);
492-
if(sp->decl_count() == 0) {
492+
if(sp->decr_count() == 0) {
493493
obj = sp->obj();
494494
--m_top;
495495
/*printf("stack pop %d\n", m_top);*/
@@ -505,7 +505,7 @@ class context {
505505
break;
506506
case CT_MAP_VALUE:
507507
unpack_map_item(sp->obj(), sp->map_key(), obj);
508-
if(sp->decl_count() == 0) {
508+
if(sp->decr_count() == 0) {
509509
obj = sp->obj();
510510
--m_top;
511511
/*printf("stack pop %d\n", m_top);*/
@@ -1239,7 +1239,7 @@ inline unpacker& unpacker::operator=(unpacker&& other) {
12391239
inline unpacker::~unpacker()
12401240
{
12411241
// These checks are required for move operations.
1242-
if (m_buffer) detail::decl_count(m_buffer);
1242+
if (m_buffer) detail::decr_count(m_buffer);
12431243
}
12441244

12451245

@@ -1303,15 +1303,15 @@ inline void unpacker::expand_buffer(std::size_t size)
13031303

13041304
if(m_ctx.user().referenced()) {
13051305
try {
1306-
m_z->push_finalizer(&detail::decl_count, m_buffer);
1306+
m_z->push_finalizer(&detail::decr_count, m_buffer);
13071307
}
13081308
catch (...) {
13091309
::free(tmp);
13101310
throw;
13111311
}
13121312
m_ctx.user().set_referenced(false);
13131313
} else {
1314-
detail::decl_count(m_buffer);
1314+
detail::decr_count(m_buffer);
13151315
}
13161316

13171317
m_buffer = tmp;
@@ -1421,7 +1421,7 @@ inline bool unpacker::flush_zone()
14211421
{
14221422
if(m_ctx.user().referenced()) {
14231423
try {
1424-
m_z->push_finalizer(&detail::decl_count, m_buffer);
1424+
m_z->push_finalizer(&detail::decr_count, m_buffer);
14251425
} catch (...) {
14261426
return false;
14271427
}

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)