[asterisk-commits] rizzo: trunk r44749 - /trunk/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Oct 8 16:04:13 MST 2006


Author: rizzo
Date: Sun Oct  8 18:04:12 2006
New Revision: 44749

URL: http://svn.digium.com/view/asterisk?rev=44749&view=rev
Log:
localize some variables and reduce nesting depth
(indentation will be fixed by a separate commit).


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=44749&r1=44748&r2=44749&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sun Oct  8 18:04:12 2006
@@ -6522,25 +6522,21 @@
 
 	add_header(&req, "Allow", ALLOWED_METHODS);
 	add_header(&req, "Supported", SUPPORTED_EXTENSIONS);
-	if (p->options && p->options->addsipheaders ) {
-		struct ast_channel *ast;
-		struct varshead *headp = NULL;
-		const struct ast_var_t *current;
-
-		ast = p->owner;	/* The owner channel */
-		if (ast) {
-			char *headdup;
-	 		headp = &ast->varshead;
+	if (p->options && p->options->addsipheaders && p->owner) {
+		struct ast_channel *ast = p->owner; /* The owner channel */
+		struct varshead *headp = &ast->varshead;
+
 			if (!headp)
 				ast_log(LOG_WARNING,"No Headp for the channel...ooops!\n");
 			else {
+				const struct ast_var_t *current;
 				AST_LIST_TRAVERSE(headp, current, entries) {  
 					/* SIPADDHEADER: Add SIP header to outgoing call */
 					if (!strncasecmp(ast_var_name(current), "SIPADDHEADER", strlen("SIPADDHEADER"))) {
 						char *content, *end;
 						const char *header = ast_var_value(current);
-
-						headdup = ast_strdupa(header);
+						char *headdup = ast_strdupa(header);
+
 						/* Strip of the starting " (if it's there) */
 						if (*headdup == '"')
 					 		headdup++;
@@ -6559,7 +6555,6 @@
 					}
 				}
 			}
-		}
 	}
 	if (sdp) {
 		if (p->udptl && p->t38.state == T38_LOCAL_DIRECT) {



More information about the asterisk-commits mailing list