Skip to content

Commit

Permalink
dialog: wrapper defines for ref/unref operations to get file name and…
Browse files Browse the repository at this point in the history
… line
  • Loading branch information
miconda committed Sep 28, 2016
1 parent cedae42 commit be77f34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions modules/dialog/dlg_hash.c
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions modules/dialog/dlg_hash.h
Expand Up @@ -389,17 +389,21 @@ 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
* \see ref_dlg_unsafe
* \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
Expand Down

0 comments on commit be77f34

Please sign in to comment.