[asterisk-commits] qwell: trunk r47775 - /trunk/channels/chan_zap.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Nov 16 15:51:01 MST 2006


Author: qwell
Date: Thu Nov 16 16:51:00 2006
New Revision: 47775

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47775
Log:
Remove the interim variable for range modifications, and set it on the structure directly.
Also move the default checking to where it gets set initially.

Fixes suggested by file.

Modified:
    trunk/channels/chan_zap.c

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=47775&r1=47774&r2=47775
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Thu Nov 16 16:51:00 2006
@@ -6615,9 +6615,6 @@
 							channel */
 							distMatches = 0;
 							for (counter1 = 0; counter1 < 3; counter1++) {
-								if (p->drings.ringnum[counter].range == 0) {
-									p->drings.ringnum[counter].range = 10;
-                                                        	}
 								ast_verbose( VERBOSE_PREFIX_3 "Ring pattern check range: %d\n", p->drings.ringnum[counter].range);
 								if (p->drings.ringnum[counter].ring[counter1] == -1) {
 									ast_verbose( VERBOSE_PREFIX_3 "Pattern ignore (-1) detected, so matching pattern %d regardless.\n",
@@ -6804,9 +6801,6 @@
 								p->drings.ringnum[counter].ring[2]);
 						distMatches = 0;
 						for (counter1 = 0; counter1 < 3; counter1++) {
-							if (p->drings.ringnum[counter].range == 0) {
-								p->drings.ringnum[counter].range = 10;
-							}
 							ast_verbose( VERBOSE_PREFIX_3 "Ring pattern check range: %d\n", p->drings.ringnum[counter].range);
 							if (p->drings.ringnum[counter].ring[counter1] == -1) {
 								ast_verbose( VERBOSE_PREFIX_3 "Pattern ignore (-1) detected, so matching pattern %d regardless.\n",
@@ -11723,7 +11717,6 @@
 	struct zt_pvt *tmp;
 	char *ringc;
 	int y;
-	int range;
 	int found_pseudo = 0;
 
 	for (; v; v = v->next) {
@@ -11753,14 +11746,20 @@
 		} else if (!strcasecmp(v->name, "dring3context")) {
 			ast_copy_string(drings.ringContext[2].contextData,v->value,sizeof(drings.ringContext[2].contextData));
 		} else if (!strcasecmp(v->name, "dring1range")) {
-			range = atoi(v->value);
-			drings.ringnum[0].range = range;
+			drings.ringnum[0].range = atoi(v->value);
+			/* 10 is a nice default. */
+			if (drings.ringnum[0].range == 0)
+				drings.ringnum[0].range = 10;
 		} else if (!strcasecmp(v->name, "dring2range")) {
-			range = atoi(v->value);
-			drings.ringnum[1].range = range;
+			drings.ringnum[1].range = atoi(v->value);
+			/* 10 is a nice default. */
+			if (drings.ringnum[1].range == 0)
+				drings.ringnum[1].range = 10;
 		} else if (!strcasecmp(v->name, "dring3range")) {
-			range = atoi(v->value);
-			drings.ringnum[2].range = range;
+			drings.ringnum[2].range = atoi(v->value);
+			/* 10 is a nice default. */
+			if (drings.ringnum[2].range == 0)
+				drings.ringnum[2].range = 10;
 		} else if (!strcasecmp(v->name, "dring1")) {
 			ringc = v->value;
 			sscanf(ringc, "%d,%d,%d", &drings.ringnum[0].ring[0], &drings.ringnum[0].ring[1], &drings.ringnum[0].ring[2]);



More information about the asterisk-commits mailing list