mirror of
https://github.com/json-c/json-c.git
synced 2026-04-04 21:09:06 +08:00
subtract first, then retrieve value
This commit is contained in:
@@ -176,7 +176,7 @@ int json_object_put(struct json_object *jso)
|
|||||||
if(!jso) return 0;
|
if(!jso) return 0;
|
||||||
|
|
||||||
#if defined __GNUC__
|
#if defined __GNUC__
|
||||||
if (__sync_fetch_and_sub(&jso->_ref_count, 1) > 0) return 0;
|
if (__sync_sub_and_fetch(&jso->_ref_count, 1) > 0) return 0;
|
||||||
#else
|
#else
|
||||||
if (--jso->_ref_count > 0) return 0;
|
if (--jso->_ref_count > 0) return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user