[sr-dev] git:master:eb016670: dialog: replaced inline function with a single log with a macro

Daniel-Constantin Mierla miconda at gmail.com
Thu Dec 28 17:07:12 CET 2017


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-12-28T17:05:22+01:00

dialog: replaced inline function with a single log with a macro

- makes possible to get the file name and line of its usage

---

Modified: src/modules/dialog/dlg_hash.c

---

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

---

diff --git a/src/modules/dialog/dlg_hash.c b/src/modules/dialog/dlg_hash.c
index df25d933cf..5779891c29 100644
--- a/src/modules/dialog/dlg_hash.c
+++ b/src/modules/dialog/dlg_hash.c
@@ -956,18 +956,19 @@ void dlg_release(dlg_cell_t *dlg)
 
 
 /*!
- * \brief Small logging helper functions for next_state_dlg.
+ * \brief Small logging helper macro for next_state_dlg.
  * \param event logged event
  * \param dlg dialog data
  * \see next_state_dlg
  */
-static inline void log_next_state_dlg(const int event, const struct dlg_cell *dlg) {
-	LM_CRIT("bogus event %d in state %d for dlg %p [%u:%u] with clid '%.*s' and tags "
-		"'%.*s' '%.*s'\n", event, dlg->state, dlg, dlg->h_entry, dlg->h_id,
-		dlg->callid.len, dlg->callid.s,
-		dlg->tag[DLG_CALLER_LEG].len, dlg->tag[DLG_CALLER_LEG].s,
-		dlg->tag[DLG_CALLEE_LEG].len, dlg->tag[DLG_CALLEE_LEG].s);
-}
+#define log_next_state_dlg(event, dlg) do { \
+		LM_CRIT("bogus event %d in state %d for dlg %p [%u:%u]" \
+			" with clid '%.*s' and tags" \
+			" '%.*s' '%.*s'\n", event, (dlg)->state, (dlg), \
+			(dlg)->h_entry, (dlg)->h_id, (dlg)->callid.len, (dlg)->callid.s, \
+			(dlg)->tag[DLG_CALLER_LEG].len, (dlg)->tag[DLG_CALLER_LEG].s, \
+			(dlg)->tag[DLG_CALLEE_LEG].len, (dlg)->tag[DLG_CALLEE_LEG].s); \
+	} while(0)
 
 
 /*!




More information about the sr-dev mailing list