[sr-dev] git:master: core: unlikely() to test ev SREV_CFG_RUN_ACTION

Daniel-Constantin Mierla miconda at gmail.com
Thu Feb 4 13:03:43 CET 2010


Module: sip-router
Branch: master
Commit: 5c679ad10a1c73d267101277ea53d52db05abbb2
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5c679ad10a1c73d267101277ea53d52db05abbb2

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Thu Feb  4 12:30:47 2010 +0100

core: unlikely() to test ev SREV_CFG_RUN_ACTION

- test if the event is enabled before creating the parameter and
  executing the callback

---

 action.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/action.c b/action.c
index e58484b..2542a9c 100644
--- a/action.c
+++ b/action.c
@@ -144,9 +144,12 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 	ser_error=E_UNSPEC;
 
 	/* hook for every executed action (in use by cfg debugger) */
-	srevp[0] = (void*)a;
-	srevp[1] = (void*)msg;
-	sr_event_exec(SREV_CFG_RUN_ACTION, (void*)srevp);
+	if(unlikely(sr_event_enabled(SREV_CFG_RUN_ACTION)))
+	{
+		srevp[0] = (void*)a;
+		srevp[1] = (void*)msg;
+		sr_event_exec(SREV_CFG_RUN_ACTION, (void*)srevp);
+	}
 
 	ret=E_BUG;
 	switch ((unsigned char)a->type){




More information about the sr-dev mailing list