Add debug functions

This commit is contained in:
2025-09-09 05:45:57 -07:00
parent aec2f6145e
commit 403618888c
3 changed files with 69 additions and 1 deletions

View File

@ -454,6 +454,24 @@ static inline bool refcount_remove_destructor(void *obj, void *key) {
key);
}
// Debug Functions
uint64_t refcount_debug_context_count_object(const RefcountContext *ctx,
void *obj, void *target);
/**
* Same as #refcount_debug_context_count_object, but only operates on the global
* context.
* @param obj The root object
* @param target The object to look for
* @return The number of times the target appeared in the reference tree of the
* root
*/
static inline uint64_t refcount_debug_count_object(void *obj, void *target) {
return refcount_debug_context_count_object(refcount_default_context, obj,
target);
}
#ifdef __cplusplus
}
#endif