json_object_private: Use unsigned 32-bit integer type for refcount

This commit is contained in:
Björn Esser
2017-12-16 17:09:39 +01:00
parent 5ea6a05bfa
commit c233f5c05e
2 changed files with 4 additions and 1 deletions

View File

@@ -169,6 +169,9 @@ extern struct json_object* json_object_get(struct json_object *jso)
{
if (!jso) return jso;
// Don't overflow the refcounter.
assert(jso->_ref_count < UINT_FAST32_MAX);
#if defined(HAVE_ATOMIC_BUILTINS) && defined(ENABLE_THREADING)
__sync_add_and_fetch(&jso->_ref_count, 1);
#else