[asterisk-commits] trunk r21878 - /trunk/pbx.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Apr 21 05:12:44 MST 2006


Author: rizzo
Date: Fri Apr 21 07:12:42 2006
New Revision: 21878

URL: http://svn.digium.com/view/asterisk?rev=21878&view=rev
Log:
minor cleanup


Modified:
    trunk/pbx.c

Modified: trunk/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx.c?rev=21878&r1=21877&r2=21878&view=diff
==============================================================================
--- trunk/pbx.c (original)
+++ trunk/pbx.c Fri Apr 21 07:12:42 2006
@@ -4157,9 +4157,10 @@
 		/* In order to do it when the channel doesn't really exist within
 		   the PBX, we have to make a new channel, masquerade, and start the PBX
 		   at the new location */
-		struct ast_channel *tmpchan;
-		tmpchan = ast_channel_alloc(0);
-		if (tmpchan) {
+		struct ast_channel *tmpchan = ast_channel_alloc(0);
+		if (!tmpchan)
+			res = -1;
+		else {
 			ast_string_field_build(tmpchan, name, "AsyncGoto/%s", chan->name);
 			ast_setstate(tmpchan, chan->_state);
 			/* Make formats okay */
@@ -4167,9 +4168,7 @@
 			tmpchan->writeformat = chan->writeformat;
 			/* Setup proper location */
 			ast_explicit_goto(tmpchan,
-					  S_OR(context, chan->context),
-					  S_OR(exten, chan->exten),
-					  priority);
+				S_OR(context, chan->context), S_OR(exten, chan->exten), priority);
 
 			/* Masquerade into temp channel */
 			ast_channel_masquerade(tmpchan, chan);
@@ -4184,8 +4183,6 @@
 				ast_hangup(tmpchan);
 				res = -1;
 			}
-		} else {
-			res = -1;
 		}
 	}
 	ast_mutex_unlock(&chan->lock);
@@ -4288,7 +4285,7 @@
 	if (callerid)
 		length += strlen(callerid) + 1;
 	else
-		length ++;
+		length ++;	/* just the '\0' */
 
 	/* Be optimistic:  Build the extension structure first */
 	if (datad == NULL)



More information about the asterisk-commits mailing list