[asterisk-commits] trunk r26804 - /trunk/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu May 11 02:38:54 MST 2006
Author: rizzo
Date: Thu May 11 04:38:53 2006
New Revision: 26804
URL: http://svn.digium.com/view/asterisk?rev=26804&view=rev
Log:
simplify init_req()
As the rest of the chan_sip.c changes i am committing, this is
Approved by: oej
Modified:
trunk/channels/chan_sip.c
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=26804&r1=26803&r2=26804&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu May 11 04:38:53 2006
@@ -4396,16 +4396,13 @@
/*! \brief Initialize SIP request */
static int init_req(struct sip_request *req, int sipmethod, const char *recip)
{
- /* Initialize a response */
- if (req->headers || req->len) {
- ast_log(LOG_WARNING, "Request already initialized?!?\n");
- return -1;
- }
- req->header[req->headers] = req->data + req->len;
- snprintf(req->header[req->headers], sizeof(req->data) - req->len, "%s %s SIP/2.0\r\n", sip_methods[sipmethod].text, recip);
- req->len += strlen(req->header[req->headers]);
+ /* Initialize a request */
+ memset(req, 0, sizeof(*req));
+ req->method = sipmethod;
+ req->header[0] = req->data;
+ snprintf(req->header[0], sizeof(req->data), "%s %s SIP/2.0\r\n", sip_methods[sipmethod].text, recip);
+ req->len = strlen(req->header[0]);
req->headers++;
- req->method = sipmethod;
return 0;
}
@@ -5286,7 +5283,6 @@
snprintf(to, sizeof(to), "<%s>", p->uri);
}
- memset(req, 0, sizeof(struct sip_request));
init_req(req, sipmethod, p->uri);
snprintf(tmp, sizeof(tmp), "%d %s", ++p->ocseq, sip_methods[sipmethod].text);
@@ -5874,7 +5870,6 @@
p->branch ^= ast_random();
- memset(&req, 0, sizeof(req));
init_req(&req, sipmethod, addr);
/* Add to CSEQ */
More information about the asterisk-commits
mailing list