[Freeswitch-svn] [commit] r8506 - freeswitch/trunk/src

Freeswitch SVN anthm at freeswitch.org
Wed May 21 16:00:00 EDT 2008


Author: anthm
Date: Wed May 21 16:00:00 2008
New Revision: 8506

Modified:
   freeswitch/trunk/src/switch_channel.c

Log:
tweak

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Wed May 21 16:00:00 2008
@@ -130,9 +130,10 @@
 	uint8_t x;
 	const char *str = "UNKNOWN";
 
-	for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) ; x++) {
+	for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) -1 ; x++) {
 		if (CAUSE_CHART[x].cause == cause) {
 			str = CAUSE_CHART[x].name;
+			break;
 		}
 	}
 
@@ -147,9 +148,10 @@
 	if (*str > 47 && *str < 58) {
 		cause = atoi(str);
 	} else {
-		for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) && CAUSE_CHART[x].name; x++) {
+		for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) - 1 && CAUSE_CHART[x].name; x++) {
 			if (!strcasecmp(CAUSE_CHART[x].name, str)) {
 				cause = CAUSE_CHART[x].cause;
+				break;
 			}
 		}
 	}



More information about the Freeswitch-svn mailing list