53
53
#endif
54
54
#endif
55
55
56
- // Don't define this. It's not thread-safe.
57
- /* #define REFCOUNT_DEBUG 1 */
58
-
59
56
const char * json_hex_chars = "0123456789abcdefABCDEF" ;
60
57
61
58
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;
161
158
* */
162
159
JSON_NORETURN static void json_abort (const char * message );
163
160
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
-
199
161
/* helper for accessing the optimized string data component in json_object
200
162
*/
201
163
static inline char * get_string_component_mutable (struct json_object * jso )
@@ -339,10 +301,6 @@ int json_object_put(struct json_object *jso)
339
301
340
302
static void json_object_generic_delete (struct json_object * jso )
341
303
{
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 */
346
304
printbuf_free (jso -> _pb );
347
305
free (jso );
348
306
}
@@ -364,10 +322,6 @@ static inline struct json_object *json_object_new(enum json_type o_type, size_t
364
322
jso -> _userdata = NULL ;
365
323
//jso->... // Type-specific fields must be set by caller
366
324
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 */
371
325
return jso ;
372
326
}
373
327
0 commit comments