فهرست منبع

dialog: wrapper defines for ref/unref operations to get file name and line

Daniel-Constantin Mierla 9 سال پیش
والد
کامیت
be77f34091
2فایلهای تغییر یافته به همراه12 افزوده شده و 4 حذف شده
  1. 6 2
      modules/dialog/dlg_hash.c
  2. 6 2
      modules/dialog/dlg_hash.h

+ 6 - 2
modules/dialog/dlg_hash.c

@@ -896,10 +896,12 @@ void link_dlg(struct dlg_cell *dlg, int n, int mode)
  * \param dlg dialog
  * \param cnt increment for the reference counter
  */
-void dlg_ref(dlg_cell_t *dlg, unsigned int cnt)
+void dlg_ref_helper(dlg_cell_t *dlg, unsigned int cnt, const char *fname,
+		int fline)
 {
 	dlg_entry_t *d_entry;
 
+	LM_DBG("ref op on %p with %d from %s:%d\n", dlg, cnt, fname, fline);
 	d_entry = &(d_table->entries[dlg->h_entry]);
 
 	dlg_lock( d_table, d_entry);
@@ -914,10 +916,12 @@ void dlg_ref(dlg_cell_t *dlg, unsigned int cnt)
  * \param dlg dialog
  * \param cnt decrement for the reference counter
  */
-void dlg_unref(dlg_cell_t *dlg, unsigned int cnt)
+void dlg_unref_helper(dlg_cell_t *dlg, unsigned int cnt, const char *fname,
+		int fline)
 {
 	dlg_entry_t *d_entry;
 
+	LM_DBG("unref op on %p with %d from %s:%d\n", dlg, cnt, fname, fline);
 	d_entry = &(d_table->entries[dlg->h_entry]);
 
 	dlg_lock( d_table, d_entry);

+ 6 - 2
modules/dialog/dlg_hash.h

@@ -389,8 +389,10 @@ void link_dlg(struct dlg_cell *dlg, int n, int mode);
  * \param dlg dialog
  * \param cnt decrement for the reference counter
  */
-void dlg_unref(dlg_cell_t *dlg, unsigned int cnt);
+void dlg_unref_helper(dlg_cell_t *dlg, unsigned int cnt, const char *fname,
+		int fline);
 
+#define dlg_unref(dlg, cnt) dlg_unref_helper((dlg), (cnt), __FILE__, __LINE__)
 
 /*!
  * \brief Refefence a dialog with locking
@@ -398,8 +400,10 @@ void dlg_unref(dlg_cell_t *dlg, unsigned int cnt);
  * \param dlg dialog
  * \param cnt increment for the reference counter
  */
-void dlg_ref(dlg_cell_t *dlg, unsigned int cnt);
+void dlg_ref_helper(dlg_cell_t *dlg, unsigned int cnt, const char *fname,
+		int fline);
 
+#define dlg_ref(dlg, cnt) dlg_ref_helper((dlg), (cnt), __FILE__, __LINE__)
 
 /*!
  * \brief Release a dialog from ref counter by 1