diff options
author | Richard Mudgett <rmudgett@digium.com> | 2012-03-02 16:26:01 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2012-03-02 16:26:01 +0000 |
commit | 2ce386d198f46933e4b6f89a36a32fbe86cad409 (patch) | |
tree | ab36e0dc63184cf12dd114491c5fa438ec21ecda /apps | |
parent | 2d92c50ce33868e8457ef25b3c5721d6f258ed0f (diff) |
Remove bad usage of goto in ChanSpy next_channel().
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357834 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_chanspy.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 933729910..e773c4789 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -742,23 +742,18 @@ static struct ast_autochan *next_channel(struct ast_channel_iterator *iter, return NULL; } -redo: - if (!(next = ast_channel_iterator_next(iter))) { - return NULL; - } + for (; (next = ast_channel_iterator_next(iter)); ast_channel_unref(next)) { + if (!strncmp(ast_channel_name(next), "DAHDI/pseudo", pseudo_len) + || next == chan) { + continue; + } - if (!strncmp(ast_channel_name(next), "DAHDI/pseudo", pseudo_len)) { + 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, |