Skip to content

Commit 2d21d3e

Browse files
committed
Improved refcount debugging by printing function and line information while *destroy as well
1 parent f703d01 commit 2d21d3e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/rd.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,14 +417,17 @@ static RD_INLINE RD_UNUSED int rd_refcnt_get(rd_refcnt_t *R) {
417417
rd_refcnt_get(R), (R), WHAT, __FUNCTION__, __LINE__), \
418418
rd_refcnt_sub0(R))
419419

420-
#define rd_refcnt_sub(R) \
420+
#define rd_refcnt_sub_fl(FUNC, LINE, R) \
421421
(fprintf(stderr, "REFCNT DEBUG: %-35s %d -1: %16p: %s:%d\n", #R, \
422-
rd_refcnt_get(R), (R), __FUNCTION__, __LINE__), \
422+
rd_refcnt_get(R), (R), (FUNC), (LINE)), \
423423
rd_refcnt_sub0(R))
424424

425+
#define rd_refcnt_sub(R) rd_refcnt_sub_fl(__FUNCTION__, __LINE__, R)
426+
425427
#else
426428
#define rd_refcnt_add_fl(FUNC, LINE, R) rd_refcnt_add0(R)
427429
#define rd_refcnt_add(R) rd_refcnt_add0(R)
430+
#define rd_refcnt_sub_fl(FUNC, LINE, R) rd_refcnt_sub0(R)
428431
#define rd_refcnt_sub(R) rd_refcnt_sub0(R)
429432
#endif
430433

0 commit comments

Comments
 (0)