Module: sip-router
Branch: tmp/core_events
Commit: da5d964be8818cadad03a637223257824bf3d031
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=da5d964…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Tue Oct 6 14:53:26 2009 +0200
core ev: minor cleanups
- use if (unlikely(...)) when executing the callbacks (optimize
for the case where there are no callbacks)
- debugging info printed only #if EXTRA_DEBUG
---
events.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/events.c b/events.c
index 7ba5e34..0d07395 100644
--- a/events.c
+++ b/events.c
@@ -60,26 +60,34 @@ int sr_event_exec(int type, void *data)
str *p;
switch(type) {
case SREV_NET_DATA_IN:
- if(_sr_events_list.net_data_in!=0)
+ if(unlikely(_sr_events_list.net_data_in!=0))
{
p = (str*)data;
+#ifdef EXTRA_DEBUG
LM_DBG("PRE-IN ++++++++++++++++++++++++++++++++\n"
"%.*s\n+++++\n", p->len, p->s);
+#endif /* EXTRA_DEBUG */
ret = _sr_events_list.net_data_in(data);
+#ifdef EXTRA_DEBUG
LM_DBG("POST-IN ++++++++++++++++++++++++++++++++\n"
"%.*s\n+++++\n", p->len, p->s);
+#endif /* EXTRA_DEBUG */
return ret;
} else return 1;
break;
case SREV_NET_DATA_OUT:
- if(_sr_events_list.net_data_out!=0)
+ if(unlikely(_sr_events_list.net_data_out!=0))
{
p = (str*)data;
+#ifdef EXTRA_DEBUG
LM_DBG("PRE-OUT ++++++++++++++++++++\n"
"%.*s\n+++++++++++++++++++\n", p->len, p->s);
+#endif /* EXTRA_DEBUG */
ret = _sr_events_list.net_data_out(data);
+#ifdef EXTRA_DEBUG
LM_DBG("POST-OUT ++++++++++++++++++++\n"
"%.*s\n+++++++++++++++++++\n", p->len, p->s);
+#endif /* EXTRA_DEBUG */
return ret;
} else return 1;
break;