Change json_object_put to return 1 if the object passed was actually freed. (or 0 if only the reference count was decremented)
diff --git a/json_object.c b/json_object.c
index d11efc5..bb344af 100644
--- a/json_object.c
+++ b/json_object.c
@@ -139,7 +139,7 @@
return jso;
}
-extern void json_object_put(struct json_object *jso)
+int json_object_put(struct json_object *jso)
{
if(jso)
{
@@ -149,8 +149,10 @@
if (jso->_user_delete)
jso->_user_delete(jso, jso->_userdata);
jso->_delete(jso);
+ return 1;
}
}
+ return 0;
}
@@ -410,7 +412,7 @@
void json_object_object_del(struct json_object* jso, const char *key)
{
- lh_table_delete(jso->o.c_object, key);
+ lh_table_delete(jso->o.c_object, key);
}