[asterisk-commits] rizzo: branch rizzo/astobj2 r47991 - /team/rizzo/astobj2/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Nov 24 09:58:25 MST 2006


Author: rizzo
Date: Fri Nov 24 10:58:25 2006
New Revision: 47991

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47991
Log:
minor cleanup in the packet-access routines.


Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=47991&r1=47990&r2=47991
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Fri Nov 24 10:58:25 2006
@@ -4946,7 +4946,7 @@
 	char *c = req->data, **dst = req->header;
 	int i = 0, lim = SIP_MAX_HEADERS - 1;
 
-	req->header[0] = c;
+	dst[0] = c;
 	req->headers = -1;	/* mark that we are working on the header */
 	for (; *c; c++) {
 		if (*c == '\r')		/* remove \r */
@@ -5626,6 +5626,7 @@
 static int add_header(struct sip_request *req, const char *var, const char *value)
 {
 	int maxlen = sizeof(req->data) - 4 - req->len; /* 4 bytes are for two \r\n ? */
+	char *dst;
 
 	if (req->headers == SIP_MAX_HEADERS) {
 		ast_log(LOG_WARNING, "Out of SIP header space\n");
@@ -5642,13 +5643,13 @@
 		return -1;
 	}
 
-	req->header[req->headers] = req->data + req->len;
+	dst = req->header[req->headers] = req->data + req->len;
 
 	if (compactheaders)
 		var = find_alias(var, var);
 
-	snprintf(req->header[req->headers], maxlen, "%s: %s\r\n", var, value);
-	req->len += strlen(req->header[req->headers]);
+	snprintf(dst, maxlen, "%s: %s\r\n", var, value);
+	req->len += strlen(dst);
 	req->headers++;
 	if (req->headers < SIP_MAX_HEADERS)
 		req->headers++;
@@ -15060,11 +15061,11 @@
 	/* Get Method and Cseq */
 
 	/* Must have Cseq */
-	if (ast_strlen_zero(req->header[0]) || ast_strlen_zero(cseq)) {
+	if (ast_strlen_zero(cseq)) {
 		ast_log(LOG_ERROR, "Missing Cseq. Dropping this SIP message, it's incomplete.\n");
 		res = 1;
 	} else if (sscanf(cseq, "%d%n", &seqno, &len) != 1) {
-		ast_log(LOG_ERROR, "No seqno in '%s'. Dropping incomplete message.\n", req->header[0]);
+		ast_log(LOG_ERROR, "No seqno in '%s'. Dropping incomplete message.\n", req->data);
 		res = 1;
 	}
 	if (res) {



More information about the asterisk-commits mailing list