]> granicus.if.org Git - json-c/commitdiff
Drop the REFCOUNT_DEBUG code, it hasn't been used in ages.
authorEric Haszlakiewicz <erh+git@nimenees.com>
Tue, 30 Nov 2021 03:08:02 +0000 (03:08 +0000)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Tue, 30 Nov 2021 03:08:02 +0000 (03:08 +0000)
ChangeLog
json_object.c

index c6f7454ebbf257ba2035e8701dfeef04611093c3..12ccba0253b0a716af617003cfc53ec4ef96b228 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@ Significant changes and bug fixes
 * Introduction of constant JSON_C_OBJECT_ADD_CONSTANT_KEY
    as a replacement of JSON_C_OBJECT_KEY_IS_CONSTANT,
    JSON_C_OBJECT_KEY_IS_CONSTANT becoming legacy.
+* Drop REFCOUNT_DEBUG code.
 
 ***
 
index 370e1d1178bfb5070173adf4eb94eaf7b1eb665e..66fd725a4917b7dcb22021bd9a58e655b61931df 100644 (file)
@@ -53,9 +53,6 @@
 #endif
 #endif
 
-// Don't define this.  It's not thread-safe.
-/* #define REFCOUNT_DEBUG 1 */
-
 const char *json_hex_chars = "0123456789abcdefABCDEF";
 
 static void json_object_generic_delete(struct json_object *jso);
@@ -161,41 +158,6 @@ static json_object_to_json_string_fn _json_object_userdata_to_json_string;
  * */
 JSON_NORETURN static void json_abort(const char *message);
 
-/* ref count debugging */
-
-#ifdef REFCOUNT_DEBUG
-
-static struct lh_table *json_object_table;
-
-static void json_object_init(void) __attribute__((constructor));
-static void json_object_init(void)
-{
-       MC_DEBUG("json_object_init: creating object table\n");
-       json_object_table = lh_kptr_table_new(128, NULL);
-}
-
-static void json_object_fini(void) __attribute__((destructor));
-static void json_object_fini(void)
-{
-       struct lh_entry *ent;
-       if (MC_GET_DEBUG())
-       {
-               if (json_object_table->count)
-               {
-                       MC_DEBUG("json_object_fini: %d referenced objects at exit\n",
-                                json_object_table->count);
-                       lh_foreach(json_object_table, ent)
-                       {
-                               struct json_object *obj = (struct json_object *)lh_entry_v(ent);
-                               MC_DEBUG("\t%s:%p\n", json_type_to_name(obj->o_type), obj);
-                       }
-               }
-       }
-       MC_DEBUG("json_object_fini: freeing object table\n");
-       lh_table_free(json_object_table);
-}
-#endif /* REFCOUNT_DEBUG */
-
 /* helper for accessing the optimized string data component in json_object
  */
 static inline char *get_string_component_mutable(struct json_object *jso)
@@ -339,10 +301,6 @@ int json_object_put(struct json_object *jso)
 
 static void json_object_generic_delete(struct json_object *jso)
 {
-#ifdef REFCOUNT_DEBUG
-       MC_DEBUG("json_object_delete_%s: %p\n", json_type_to_name(jso->o_type), jso);
-       lh_table_delete(json_object_table, jso);
-#endif /* REFCOUNT_DEBUG */
        printbuf_free(jso->_pb);
        free(jso);
 }
@@ -364,10 +322,6 @@ static inline struct json_object *json_object_new(enum json_type o_type, size_t
        jso->_userdata = NULL;
        //jso->...   // Type-specific fields must be set by caller
 
-#ifdef REFCOUNT_DEBUG
-       lh_table_insert(json_object_table, jso, jso);
-       MC_DEBUG("json_object_new_%s: %p\n", json_type_to_name(jso->o_type), jso);
-#endif /* REFCOUNT_DEBUG */
        return jso;
 }