Browse Source

Merge pull request #454 from ramiropolla/json_object_private

json_object_private: save 8 bytes in struct json_object in 64-bit arc…
tags/json-c-0.14-20200419
Eric Haszlakiewicz GitHub 6 years ago
parent
commit
240627f260
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      json_object.c
  2. +1
    -1
      json_object_private.h

+ 1
- 1
json_object.c View File

@@ -171,7 +171,7 @@ extern struct json_object* json_object_get(struct json_object *jso)
if (!jso) return jso; if (!jso) return jso;


// Don't overflow the refcounter. // 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) #if defined(HAVE_ATOMIC_BUILTINS) && defined(ENABLE_THREADING)
__sync_add_and_fetch(&jso->_ref_count, 1); __sync_add_and_fetch(&jso->_ref_count, 1);


+ 1
- 1
json_object_private.h View File

@@ -27,9 +27,9 @@ typedef void (json_object_private_delete_fn)(struct json_object *o);
struct json_object struct json_object
{ {
enum json_type o_type; enum json_type o_type;
uint32_t _ref_count;
json_object_private_delete_fn *_delete; json_object_private_delete_fn *_delete;
json_object_to_json_string_fn *_to_json_string; json_object_to_json_string_fn *_to_json_string;
uint_fast32_t _ref_count;
struct printbuf *_pb; struct printbuf *_pb;
union data { union data {
json_bool c_boolean; json_bool c_boolean;


Loading…
Cancel
Save