[sr-dev] git:master:be77f340: dialog: wrapper defines for ref/unref operations to get file name and line

Daniel-Constantin Mierla miconda at gmail.com
Wed Sep 28 16:42:42 CEST 2016


Module: kamailio
Branch: master
Commit: be77f34091f63042b4df4d5445fc16c1da3ddcd9
URL: https://github.com/kamailio/kamailio/commit/be77f34091f63042b4df4d5445fc16c1da3ddcd9

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-09-28T16:42:22+02:00

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

---

Modified: modules/dialog/dlg_hash.c
Modified: modules/dialog/dlg_hash.h

---

Diff:  https://github.com/kamailio/kamailio/commit/be77f34091f63042b4df4d5445fc16c1da3ddcd9.diff
Patch: https://github.com/kamailio/kamailio/commit/be77f34091f63042b4df4d5445fc16c1da3ddcd9.patch

---

diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c
index 98c0ee5..b2cf707 100644
--- a/modules/dialog/dlg_hash.c
+++ b/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);
diff --git a/modules/dialog/dlg_hash.h b/modules/dialog/dlg_hash.h
index 12c09e0..daa5221 100644
--- a/modules/dialog/dlg_hash.h
+++ b/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




More information about the sr-dev mailing list