Skip to content

Commit 320548c

Browse files
committed
Drop the REFCOUNT_DEBUG code, it hasn't been used in ages.
1 parent 9a90b84 commit 320548c

File tree

2 files changed

+1
-46
lines changed

2 files changed

+1
-46
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Significant changes and bug fixes
77
* Introduction of constant JSON_C_OBJECT_ADD_CONSTANT_KEY
88
as a replacement of JSON_C_OBJECT_KEY_IS_CONSTANT,
99
JSON_C_OBJECT_KEY_IS_CONSTANT becoming legacy.
10+
* Drop REFCOUNT_DEBUG code.
1011

1112
***
1213

json_object.c

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@
5353
#endif
5454
#endif
5555

56-
// Don't define this. It's not thread-safe.
57-
/* #define REFCOUNT_DEBUG 1 */
58-
5956
const char *json_hex_chars = "0123456789abcdefABCDEF";
6057

6158
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;
161158
* */
162159
JSON_NORETURN static void json_abort(const char *message);
163160

164-
/* ref count debugging */
165-
166-
#ifdef REFCOUNT_DEBUG
167-
168-
static struct lh_table *json_object_table;
169-
170-
static void json_object_init(void) __attribute__((constructor));
171-
static void json_object_init(void)
172-
{
173-
MC_DEBUG("json_object_init: creating object table\n");
174-
json_object_table = lh_kptr_table_new(128, NULL);
175-
}
176-
177-
static void json_object_fini(void) __attribute__((destructor));
178-
static void json_object_fini(void)
179-
{
180-
struct lh_entry *ent;
181-
if (MC_GET_DEBUG())
182-
{
183-
if (json_object_table->count)
184-
{
185-
MC_DEBUG("json_object_fini: %d referenced objects at exit\n",
186-
json_object_table->count);
187-
lh_foreach(json_object_table, ent)
188-
{
189-
struct json_object *obj = (struct json_object *)lh_entry_v(ent);
190-
MC_DEBUG("\t%s:%p\n", json_type_to_name(obj->o_type), obj);
191-
}
192-
}
193-
}
194-
MC_DEBUG("json_object_fini: freeing object table\n");
195-
lh_table_free(json_object_table);
196-
}
197-
#endif /* REFCOUNT_DEBUG */
198-
199161
/* helper for accessing the optimized string data component in json_object
200162
*/
201163
static inline char *get_string_component_mutable(struct json_object *jso)
@@ -339,10 +301,6 @@ int json_object_put(struct json_object *jso)
339301

340302
static void json_object_generic_delete(struct json_object *jso)
341303
{
342-
#ifdef REFCOUNT_DEBUG
343-
MC_DEBUG("json_object_delete_%s: %p\n", json_type_to_name(jso->o_type), jso);
344-
lh_table_delete(json_object_table, jso);
345-
#endif /* REFCOUNT_DEBUG */
346304
printbuf_free(jso->_pb);
347305
free(jso);
348306
}
@@ -364,10 +322,6 @@ static inline struct json_object *json_object_new(enum json_type o_type, size_t
364322
jso->_userdata = NULL;
365323
//jso->... // Type-specific fields must be set by caller
366324

367-
#ifdef REFCOUNT_DEBUG
368-
lh_table_insert(json_object_table, jso, jso);
369-
MC_DEBUG("json_object_new_%s: %p\n", json_type_to_name(jso->o_type), jso);
370-
#endif /* REFCOUNT_DEBUG */
371325
return jso;
372326
}
373327

0 commit comments

Comments
 (0)