Quellcode durchsuchen

core: unlikely() to test ev SREV_CFG_RUN_ACTION

- test if the event is enabled before creating the parameter and
  executing the callback
Daniel-Constantin Mierla vor 15 Jahren
Ursprung
Commit
5c679ad10a
1 geänderte Dateien mit 6 neuen und 3 gelöschten Zeilen
  1. 6 3
      action.c

+ 6 - 3
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){