Browse code

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

Daniel-Constantin Mierla authored on 28/09/2016 09:54:32
Showing 2 changed files
... ...
@@ -896,10 +896,12 @@ void link_dlg(struct dlg_cell *dlg, int n, int mode)
896 896
  * \param dlg dialog
897 897
  * \param cnt increment for the reference counter
898 898
  */
899
-void dlg_ref(dlg_cell_t *dlg, unsigned int cnt)
899
+void dlg_ref_helper(dlg_cell_t *dlg, unsigned int cnt, const char *fname,
900
+		int fline)
900 901
 {
901 902
 	dlg_entry_t *d_entry;
902 903
 
904
+	LM_DBG("ref op on %p with %d from %s:%d\n", dlg, cnt, fname, fline);
903 905
 	d_entry = &(d_table->entries[dlg->h_entry]);
904 906
 
905 907
 	dlg_lock( d_table, d_entry);
... ...
@@ -914,10 +916,12 @@ void dlg_ref(dlg_cell_t *dlg, unsigned int cnt)
914 914
  * \param dlg dialog
915 915
  * \param cnt decrement for the reference counter
916 916
  */
917
-void dlg_unref(dlg_cell_t *dlg, unsigned int cnt)
917
+void dlg_unref_helper(dlg_cell_t *dlg, unsigned int cnt, const char *fname,
918
+		int fline)
918 919
 {
919 920
 	dlg_entry_t *d_entry;
920 921
 
922
+	LM_DBG("unref op on %p with %d from %s:%d\n", dlg, cnt, fname, fline);
921 923
 	d_entry = &(d_table->entries[dlg->h_entry]);
922 924
 
923 925
 	dlg_lock( d_table, d_entry);
... ...
@@ -389,8 +389,10 @@ void link_dlg(struct dlg_cell *dlg, int n, int mode);
389 389
  * \param dlg dialog
390 390
  * \param cnt decrement for the reference counter
391 391
  */
392
-void dlg_unref(dlg_cell_t *dlg, unsigned int cnt);
392
+void dlg_unref_helper(dlg_cell_t *dlg, unsigned int cnt, const char *fname,
393
+		int fline);
393 394
 
395
+#define dlg_unref(dlg, cnt) dlg_unref_helper((dlg), (cnt), __FILE__, __LINE__)
394 396
 
395 397
 /*!
396 398
  * \brief Refefence a dialog with locking
... ...
@@ -398,8 +400,10 @@ void dlg_unref(dlg_cell_t *dlg, unsigned int cnt);
398 398
  * \param dlg dialog
399 399
  * \param cnt increment for the reference counter
400 400
  */
401
-void dlg_ref(dlg_cell_t *dlg, unsigned int cnt);
401
+void dlg_ref_helper(dlg_cell_t *dlg, unsigned int cnt, const char *fname,
402
+		int fline);
402 403
 
404
+#define dlg_ref(dlg, cnt) dlg_ref_helper((dlg), (cnt), __FILE__, __LINE__)
403 405
 
404 406
 /*!
405 407
  * \brief Release a dialog from ref counter by 1