core: unlikely() to test ev SREV_CFG_RUN_ACTION
authorDaniel-Constantin Mierla <miconda@gmail.com>
Thu, 4 Feb 2010 11:30:47 +0000 (12:30 +0100)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Thu, 4 Feb 2010 12:02:43 +0000 (13:02 +0100)
- test if the event is enabled before creating the parameter and
  executing the callback

action.c

index e58484b..2542a9c 100644 (file)
--- 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){