From: Luigi Rizzo Date: Sun, 8 Oct 2006 23:04:12 +0000 (+0000) Subject: localize some variables and reduce nesting depth X-Git-Tag: 1.6.0-beta1~3^2~4469 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06ef2c19076240e71ccb0348daada7228a7e5db1;p=thirdparty%2Fasterisk.git localize some variables and reduce nesting depth (indentation will be fixed by a separate commit). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44749 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 624a9204e1..0ed3390dcb 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -6522,25 +6522,21 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init) 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); + char *headdup = ast_strdupa(header); - headdup = ast_strdupa(header); /* Strip of the starting " (if it's there) */ if (*headdup == '"') headdup++; @@ -6559,7 +6555,6 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init) } } } - } } if (sdp) { if (p->udptl && p->t38.state == T38_LOCAL_DIRECT) {