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

Daniel-Constantin Mierla miconda at gmail.com
Thu Sep 29 09:23:29 CEST 2016


Module: kamailio
Branch: 4.4
Commit: 1987a419fbd551b6bc4550fe4f991a2a9d2ed2fb
URL: https://github.com/kamailio/kamailio/commit/1987a419fbd551b6bc4550fe4f991a2a9d2ed2fb

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-09-29T09:21:27+02:00

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

(cherry picked from commit be77f34091f63042b4df4d5445fc16c1da3ddcd9)

---

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

---

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

---

diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c
index 9a96f1b..e0b603d 100644
--- a/modules/dialog/dlg_hash.c
+++ b/modules/dialog/dlg_hash.c
@@ -894,10 +894,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);
@@ -912,10 +914,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 954a7d4..f276f5c 100644
--- a/modules/dialog/dlg_hash.h
+++ b/modules/dialog/dlg_hash.h
@@ -387,8 +387,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
@@ -396,8 +398,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