]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
subtract first, then retrieve value 211/head
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>
Sat, 28 Nov 2015 13:19:43 +0000 (14:19 +0100)
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>
Sat, 28 Nov 2015 13:19:43 +0000 (14:19 +0100)
json_object.c

index eae0f8a8b1606cf3c57a641f9cd65db3f65f757c..b7ca93b35c34e337593fe782de6e40becb020d8b 100644 (file)
@@ -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