Add tree walking debug function
This commit is contained in:
		| @ -457,6 +457,34 @@ static inline bool refcount_remove_destructor(void *obj, void *key) { | ||||
| } | ||||
|  | ||||
| // Debug Functions | ||||
| /** | ||||
|  * Callback used from #refcount_debug_context_walk_tree. | ||||
|  * @param cur The current object in the walk | ||||
|  * @param trail The parent objects, up to the root object | ||||
|  * @return True if the walk should stop, false otherwise | ||||
|  */ | ||||
| typedef bool (*refcount_debug_walk_callback_t)(void *cur, | ||||
|                                                const RefcountList *trail, | ||||
|                                                void *user_data); | ||||
|  | ||||
| bool refcount_debug_context_walk_tree(const RefcountContext *ctx, void *obj, | ||||
|                                       refcount_debug_walk_callback_t callback, | ||||
|                                       void *user_data); | ||||
|  | ||||
| /** | ||||
|  * Same as #refcount_debug_context_walk_tree, but only operates on the global | ||||
|  * context. | ||||
|  * @param obj The root object | ||||
|  * @param callback The callback | ||||
|  * @param user_data Extra data to pass to the callback | ||||
|  * @return True if the walk ended early because a callback returned true, false | ||||
|  */ | ||||
| static inline bool | ||||
| refcount_debug_walk_tree(void *obj, refcount_debug_walk_callback_t callback, | ||||
|                          void *user_data) { | ||||
|     return refcount_debug_context_walk_tree(refcount_default_context, obj, | ||||
|                                             callback, user_data); | ||||
| } | ||||
|  | ||||
| uint64_t refcount_debug_context_count_object(const RefcountContext *ctx, | ||||
|                                              void *obj, void *target); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user