json_object_private: save 8 bytes in struct json_object in 64-bit architectures

- there is no need for _ref_count to be uint_fast32_t (the compiler
  might decide to use a 64-bit int). make it uint32_t instead.
- reorder the 32-bit integer fields (o_type and _ref_count) so that
  there is no wasted 4-byte gap after each of them.
This commit is contained in:
Ramiro Polla
2018-11-24 03:36:51 +01:00
parent ebe520e96e
commit 5bb5e2e8fc
2 changed files with 2 additions and 2 deletions

View File

@@ -171,7 +171,7 @@ 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);
assert(jso->_ref_count < UINT32_MAX);
#if defined(HAVE_ATOMIC_BUILTINS) && defined(ENABLE_THREADING)
__sync_add_and_fetch(&jso->_ref_count, 1);