[asterisk-commits] file: branch group/pimp_my_sip r382362 - /team/group/pimp_my_sip/res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Mar 2 10:49:42 CST 2013
Author: file
Date: Sat Mar 2 10:49:39 2013
New Revision: 382362
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382362
Log:
Slightly reduce memory usage and copying.
Modified:
team/group/pimp_my_sip/res/res_sip_session.c
Modified: team/group/pimp_my_sip/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip_session.c?view=diff&rev=382362&r1=382361&r2=382362
==============================================================================
--- team/group/pimp_my_sip/res/res_sip_session.c (original)
+++ team/group/pimp_my_sip/res/res_sip_session.c Sat Mar 2 10:49:39 2013
@@ -875,16 +875,12 @@
static void handle_incoming_request(struct ast_sip_session *session, pjsip_rx_data *rdata)
{
struct ast_sip_session_supplement *supplement;
- char method[16];
struct pjsip_request_line req = rdata->msg_info.msg->line.req;
- pj_str_t *pj_method = &req.method.name;
-
- ast_copy_pj_str(method, pj_method, sizeof(method));
-
- ast_debug(3, "Method is %s\n", method);
+
+ ast_debug(3, "Method is %.*s\n", (int) pj_strlen(&req.method.name), pj_strbuf(&req.method.name));
AST_LIST_TRAVERSE(&session->supplements, supplement, next) {
if (supplement->incoming_request && (
- !supplement->method || !strcmp(supplement->method, method))) {
+ !supplement->method || !pj_strcmp2(&req.method.name, supplement->method))) {
supplement->incoming_request(session, rdata);
}
}
@@ -894,16 +890,13 @@
{
struct ast_sip_session_supplement *supplement;
struct pjsip_status_line status = rdata->msg_info.msg->line.status;
- char method[16];
- pj_str_t *pj_method = &rdata->msg_info.cseq->method.name;
- ast_copy_pj_str(method, pj_method, sizeof(method));
ast_debug(3, "Response is %d %.*s\n", status.code, (int) pj_strlen(&status.reason),
pj_strbuf(&status.reason));
AST_LIST_TRAVERSE(&session->supplements, supplement, next) {
if (supplement->incoming_response && (
- !supplement->method || !strcmp(supplement->method, method))) {
+ !supplement->method || !pj_strcmp2(&rdata->msg_info.cseq->method.name, supplement->method))) {
supplement->incoming_response(session, rdata);
}
}
@@ -960,16 +953,12 @@
static void handle_outgoing_request(struct ast_sip_session *session, pjsip_tx_data *tdata)
{
struct ast_sip_session_supplement *supplement;
- char method[16];
struct pjsip_request_line req = tdata->msg->line.req;
- pj_str_t *pj_method = &req.method.name;
-
- ast_copy_pj_str(method, pj_method, sizeof(method));
-
- ast_debug(3, "Method is %s\n", method);
+
+ ast_debug(3, "Method is %.*s\n", (int) pj_strlen(&req.method.name), pj_strbuf(&req.method.name));
AST_LIST_TRAVERSE(&session->supplements, supplement, next) {
- if (supplement->outgoing_request &&
- (!supplement->method || !strcmp(supplement->method, method))) {
+ if (supplement->outgoing_request &&
+ (!supplement->method || !pj_strcmp2(&req.method.name, supplement->method))) {
supplement->outgoing_request(session, tdata);
}
}
More information about the asterisk-commits
mailing list