Module: kamailio
Branch: master
Commit: 5a84ca7a2e3f3cdcde0ff444aee272eb0a8c5561
URL:
https://github.com/kamailio/kamailio/commit/5a84ca7a2e3f3cdcde0ff444aee272e…
Author: Henning Westerholt <hw(a)kamailio.org>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2018-03-12T21:59:10+01:00
core: receive.c optimization, add a few unlikely compiler builtin in error path
---
Modified: src/core/receive.c
---
Diff:
https://github.com/kamailio/kamailio/commit/5a84ca7a2e3f3cdcde0ff444aee272e…
Patch:
https://github.com/kamailio/kamailio/commit/5a84ca7a2e3f3cdcde0ff444aee272e…
---
diff --git a/src/core/receive.c b/src/core/receive.c
index 3b98438e34..27d4bd9986 100644
--- a/src/core/receive.c
+++ b/src/core/receive.c
@@ -189,7 +189,7 @@ int receive_msg(char *buf, unsigned int len, struct receive_info
*rcv_info)
len = inb.len;
msg = pkg_malloc(sizeof(struct sip_msg));
- if(msg == 0) {
+ if(unlikely(msg == 0)) {
LM_ERR("no mem for sip_msg\n");
goto error00;
}
@@ -225,8 +225,8 @@ int receive_msg(char *buf, unsigned int len, struct receive_info
*rcv_info)
goto error02;
}
- if(parse_headers(msg, HDR_FROM_F | HDR_TO_F | HDR_CALLID_F | HDR_CSEQ_F, 0)
- < 0) {
+ if(unlikely(parse_headers(msg, HDR_FROM_F | HDR_TO_F | HDR_CALLID_F | HDR_CSEQ_F, 0)
+ < 0)) {
LM_WARN("parsing relevant headers failed\n");
}
LM_DBG("--- received sip message - %s - call-id: [%.*s] - cseq: [%.*s]\n",
@@ -259,7 +259,7 @@ int receive_msg(char *buf, unsigned int len, struct receive_info
*rcv_info)
}
}
/* sanity checks */
- if((msg->via1 == 0) || (msg->via1->error != PARSE_OK)) {
+ if(unlikely((msg->via1 == 0) || (msg->via1->error != PARSE_OK))) {
/* no via, send back error ? */
LM_ERR("no via found in request\n");
STATS_BAD_MSG();