From 7e98ed93f4942a1baade1bade36a67c77b43ec85 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Sat, 28 Nov 2015 14:19:43 +0100 Subject: [PATCH] subtract first, then retrieve value --- json_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json_object.c b/json_object.c index eae0f8a8..b7ca93b3 100644 --- a/json_object.c +++ b/json_object.c @@ -176,7 +176,7 @@ int json_object_put(struct json_object *jso) if(!jso) return 0; #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 if (--jso->_ref_count > 0) return 0; #endif -- 2.47.2