[asterisk-commits] rmudgett: trunk r357834 - /trunk/apps/app_chanspy.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 2 10:26:03 CST 2012


Author: rmudgett
Date: Fri Mar  2 10:26:01 2012
New Revision: 357834

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=357834
Log:
Remove bad usage of goto in ChanSpy next_channel().

Modified:
    trunk/apps/app_chanspy.c

Modified: trunk/apps/app_chanspy.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_chanspy.c?view=diff&rev=357834&r1=357833&r2=357834
==============================================================================
--- trunk/apps/app_chanspy.c (original)
+++ trunk/apps/app_chanspy.c Fri Mar  2 10:26:01 2012
@@ -742,23 +742,18 @@
 		return NULL;
 	}
 
-redo:
-	if (!(next = ast_channel_iterator_next(iter))) {
-		return NULL;
-	}
-
-	if (!strncmp(ast_channel_name(next), "DAHDI/pseudo", pseudo_len)) {
+	for (; (next = ast_channel_iterator_next(iter)); ast_channel_unref(next)) {
+		if (!strncmp(ast_channel_name(next), "DAHDI/pseudo", pseudo_len)
+			|| next == chan) {
+			continue;
+		}
+
+		autochan_store = ast_autochan_setup(next);
 		ast_channel_unref(next);
-		goto redo;
-	} else if (next == chan) {
-		ast_channel_unref(next);
-		goto redo;
-	}
-
-	autochan_store = ast_autochan_setup(next);
-	ast_channel_unref(next);
-
-	return autochan_store;
+
+		return autochan_store;
+	}
+	return NULL;
 }
 
 static int common_exec(struct ast_channel *chan, struct ast_flags *flags,




More information about the asterisk-commits mailing list