[asterisk-commits] trunk r28704 - /trunk/channels/chan_zap.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri May 19 10:15:30 MST 2006


Author: file
Date: Fri May 19 12:15:29 2006
New Revision: 28704

URL: http://svn.digium.com/view/asterisk?rev=28704&view=rev
Log:
Clean up some chan_zap code to make it more readable. (issue #6834 reported by ppyy)

Modified:
    trunk/channels/chan_zap.c

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?rev=28704&r1=28703&r2=28704&view=diff
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Fri May 19 12:15:29 2006
@@ -7802,7 +7802,6 @@
 	ZT_PARAMS param;
 	int principle = -1;
 	int explicit = PRI_EXPLICIT(channel);
-	span = PRI_SPAN(channel);
 	channel = PRI_CHANNEL(channel);
 
 	if (!explicit) {
@@ -8724,14 +8723,11 @@
 				if (chanpos < 0) {
 					ast_log(LOG_WARNING, "Ringing requested on unconfigured channel %d/%d span %d\n", 
 						PRI_SPAN(e->ringing.channel), PRI_CHANNEL(e->ringing.channel), pri->span);
-					chanpos = -1;
-				}
-				if (chanpos > -1) {
+				} else {
 					chanpos = pri_fixup_principle(pri, chanpos, e->ringing.call);
 					if (chanpos < 0) {
 						ast_log(LOG_WARNING, "Ringing requested on channel %d/%d not in use on span %d\n", 
 							PRI_SPAN(e->ringing.channel), PRI_CHANNEL(e->ringing.channel), pri->span);
-						chanpos = -1;
 					} else {
 						ast_mutex_lock(&pri->pvts[chanpos]->lock);
 						if (ast_strlen_zero(pri->pvts[chanpos]->dop.dialstr)) {
@@ -8844,14 +8840,11 @@
 				if (chanpos < 0) {
 					ast_log(LOG_WARNING, "Facility Name requested on unconfigured channel %d/%d span %d\n", 
 						PRI_SPAN(e->facname.channel), PRI_CHANNEL(e->facname.channel), pri->span);
-					chanpos = -1;
-				}
-				if (chanpos > -1) {
+				} else {
 					chanpos = pri_fixup_principle(pri, chanpos, e->facname.call);
 					if (chanpos < 0) {
 						ast_log(LOG_WARNING, "Facility Name requested on channel %d/%d not in use on span %d\n", 
 							PRI_SPAN(e->facname.channel), PRI_CHANNEL(e->facname.channel), pri->span);
-						chanpos = -1;
 					} else {
 						/* Re-use *69 field for PRI */
 						ast_mutex_lock(&pri->pvts[chanpos]->lock);
@@ -8868,14 +8861,11 @@
 				if (chanpos < 0) {
 					ast_log(LOG_WARNING, "Answer on unconfigured channel %d/%d span %d\n", 
 						PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), pri->span);
-					chanpos = -1;
-				}
-				if (chanpos > -1) {
+				} else {
 					chanpos = pri_fixup_principle(pri, chanpos, e->answer.call);
 					if (chanpos < 0) {
 						ast_log(LOG_WARNING, "Answer requested on channel %d/%d not in use on span %d\n", 
 							PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), pri->span);
-						chanpos = -1;
 					} else {
 						ast_mutex_lock(&pri->pvts[chanpos]->lock);
 						/* Now we can do call progress detection */
@@ -8929,9 +8919,7 @@
 				if (chanpos < 0) {
 					ast_log(LOG_WARNING, "Hangup requested on unconfigured channel %d/%d span %d\n", 
 						PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
-					chanpos = -1;
-				}
-				if (chanpos > -1) {
+				} else {
 					chanpos = pri_fixup_principle(pri, chanpos, e->hangup.call);
 					if (chanpos > -1) {
 						ast_mutex_lock(&pri->pvts[chanpos]->lock);
@@ -8999,9 +8987,7 @@
 				if (chanpos < 0) {
 					ast_log(LOG_WARNING, "Hangup REQ requested on unconfigured channel %d/%d span %d\n", 
 						PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
-					chanpos = -1;
-				}
-				if (chanpos > -1) {
+				} else {
 					chanpos = pri_fixup_principle(pri, chanpos, e->hangup.call);
 					if (chanpos > -1) {
 						ast_mutex_lock(&pri->pvts[chanpos]->lock);
@@ -9059,9 +9045,7 @@
 				if (chanpos < 0) {
 					ast_log(LOG_WARNING, "Hangup ACK requested on unconfigured channel number %d/%d span %d\n", 
 						PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
-					chanpos = -1;
-				}
-				if (chanpos > -1) {
+				} else {
 					chanpos = pri_fixup_principle(pri, chanpos, e->hangup.call);
 					if (chanpos > -1) {
 						ast_mutex_lock(&pri->pvts[chanpos]->lock);
@@ -9118,9 +9102,7 @@
 						ast_log(LOG_WARNING, "Restart ACK requested on strange channel %d/%d span %d\n", 
 							PRI_SPAN(e->restartack.channel), PRI_CHANNEL(e->restartack.channel), pri->span);
 					}
-					chanpos = -1;
-				}
-				if (chanpos > -1) {
+				} else {
 					if (pri->pvts[chanpos]) {
 						ast_mutex_lock(&pri->pvts[chanpos]->lock);
 						if (pri->pvts[chanpos]->realcall) 



More information about the asterisk-commits mailing list