[asterisk-commits] nadi: trunk r46906 - in /trunk/channels: misdn/isdn_lib.c misdn_config.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Nov 2 08:47:24 MST 2006


Author: nadi
Date: Thu Nov  2 09:47:23 2006
New Revision: 46906

URL: http://svn.digium.com/view/asterisk?rev=46906&view=rev
Log:
find_free_chan_in_stack: cleanup buggy usage

Modified:
    trunk/channels/misdn/isdn_lib.c
    trunk/channels/misdn_config.c

Modified: trunk/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn/isdn_lib.c?rev=46906&r1=46905&r2=46906&view=diff
==============================================================================
--- trunk/channels/misdn/isdn_lib.c (original)
+++ trunk/channels/misdn/isdn_lib.c Thu Nov  2 09:47:23 2006
@@ -826,14 +826,13 @@
 	int l3_id;
 	int i;
 	struct misdn_stack *stack=get_stack_by_bc(bc);
-	int free_chan;
   
 	if (stack->nt) {
-		free_chan = find_free_chan_in_stack(stack, bc, bc->channel_preselected?bc->channel:0);
-		if (!free_chan) return -1;
+		if (!find_free_chan_in_stack(stack, bc, bc->channel_preselected ? bc->channel : 0))
+			return -1;
 		/*bc->channel=free_chan;*/
 		
-		cb_log(4,stack->port, " -->  found channel: %d\n",free_chan);
+		cb_log(4,stack->port, " -->  found channel: %d\n", bc->channel);
     
 		for (i=0; i <= MAXPROCS; i++)
 			if (stack->procids[i]==0) break;
@@ -859,10 +858,10 @@
 	} else { 
 		if (stack->ptp || bc->te_choose_channel) {
 			/* we know exactly which channels are in use */
-			free_chan = find_free_chan_in_stack(stack, bc, bc->channel_preselected?bc->channel:0);
-			if (!free_chan) return -1;
+			if (!find_free_chan_in_stack(stack, bc, bc->channel_preselected ? bc->channel : 0))
+				return -1;
 			/*bc->channel=free_chan;*/
-			cb_log(2,stack->port, " -->  found channel: %d\n",free_chan);
+			cb_log(2,stack->port, " -->  found channel: %d\n", bc->channel);
 		} else {
 			/* other phones could have made a call also on this port (ptmp) */
 			bc->channel=0xff;
@@ -1498,8 +1497,7 @@
 			
 		{
 			if (bc->channel == 0xff) {
-				bc->channel=find_free_chan_in_stack(stack, bc,  0);
-				if (!bc->channel) {
+				if (!find_free_chan_in_stack(stack, bc, 0)) {
 					cb_log(0, stack->port, "Any Channel Requested, but we have no more!!\n");
 					break;
 				}
@@ -1801,9 +1799,7 @@
 			bc->l3_id=hh->dinfo;
 
 			if (bc->channel<=0) {
-				bc->channel=find_free_chan_in_stack(stack,0,0);
-
-				if (bc->channel<=0)
+				if (!find_free_chan_in_stack(stack, bc, 0))
 					goto ERR_NO_CHANNEL;
 			}
 		}
@@ -2042,8 +2038,7 @@
 
 					} else {
 
-						bc->channel = find_free_chan_in_stack(stack, bc, 0);
-						if (!bc->channel) {
+						if (!find_free_chan_in_stack(stack, bc, 0)) {
 							cb_log(0, stack->port, " No free channel at the moment\n");
 					
 							msg_t *dmsg;
@@ -3232,8 +3227,7 @@
 
 		if (stack->nt) {
 			if (bc->channel <=0 ) { /*  else we have the channel already */
-				bc->channel = find_free_chan_in_stack(stack, bc, 0);
-				if (!bc->channel) {
+				if (!find_free_chan_in_stack(stack, bc, 0)) {
 					cb_log(0, stack->port, " No free channel at the moment\n");
 					
 					err=-ENOCHAN;

Modified: trunk/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn_config.c?rev=46906&r1=46905&r2=46906&view=diff
==============================================================================
--- trunk/channels/misdn_config.c (original)
+++ trunk/channels/misdn_config.c Thu Nov  2 09:47:23 2006
@@ -302,8 +302,8 @@
 		"\t   yes (= 4 seconds)\n"
 		"\t   no  (= 0 seconds = disabled)" },
 	{ "nttimeout", MISDN_CFG_NTTIMEOUT, MISDN_CTYPE_BOOL, "no", NONE ,
-		"Set this to yes if you want calls disconnected in overlap mode" 
-		"when a timeout happens.\n"},
+		"Set this to yes if you want calls disconnected in overlap mode\n"
+		"\twhen a timeout happens." },
 	{ "msns", MISDN_CFG_MSNS, MISDN_CTYPE_MSNLIST, NO_DEFAULT, NONE,
 		"MSN's for TE ports, listen on those numbers on the above ports, and\n"
 		"\tindicate the incoming calls to Asterisk.\n"



More information about the asterisk-commits mailing list