[asterisk-commits] nadi: branch 1.4 r46963 - /branches/1.4/channels/misdn/isdn_lib.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Nov 2 10:17:37 MST 2006


Author: nadi
Date: Thu Nov  2 11:17:36 2006
New Revision: 46963

URL: http://svn.digium.com/view/asterisk?rev=46963&view=rev
Log:
find_free_chan_in_stack usage fix

Modified:
    branches/1.4/channels/misdn/isdn_lib.c

Modified: branches/1.4/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/misdn/isdn_lib.c?rev=46963&r1=46962&r2=46963&view=diff
==============================================================================
--- branches/1.4/channels/misdn/isdn_lib.c (original)
+++ branches/1.4/channels/misdn/isdn_lib.c Thu Nov  2 11:17:36 2006
@@ -183,7 +183,9 @@
 void misdn_tx_jitter(struct misdn_bchannel *bc, int len);
 
 struct misdn_bchannel *find_bc_by_l3id(struct misdn_stack *stack, unsigned long l3id);
+
 struct misdn_bchannel *find_bc_by_confid(unsigned long confid);
+
 struct misdn_bchannel *stack_holder_find_bychan(struct misdn_stack *stack, int chan);
 
 int setup_bc(struct misdn_bchannel *bc);
@@ -824,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;
@@ -857,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;
@@ -1496,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;
 				}
@@ -1799,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;
 			}
 		}
@@ -2040,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;
@@ -3230,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;



More information about the asterisk-commits mailing list