summaryrefslogtreecommitdiff
path: root/res/res_musiconhold.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2005-06-06 02:29:18 +0000
committerKevin P. Fleming <kpfleming@digium.com>2005-06-06 02:29:18 +0000
commit1bac31d6bdcde7988dab684f053cc8fe5fafed41 (patch)
treebe967c9ab3099202d13219196b5f17284a939e78 /res/res_musiconhold.c
parentbccc1171f049c459bd987d009a2f984e5aec4a8e (diff)
more efficient (and understandable) ast_channel_walk_locked, and vastly more efficient ast_channel_by_name_locked (bug #4265)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5853 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_musiconhold.c')
-rwxr-xr-xres/res_musiconhold.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index df018b429..3b8c5b098 100755
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -962,10 +962,11 @@ static void ast_moh_destroy(void)
ast_mutex_unlock(&moh_lock);
}
-static void moh_on_off(int on) {
- struct ast_channel *chan = ast_channel_walk_locked(NULL);
+static void moh_on_off(int on)
+{
+ struct ast_channel *chan = NULL;
- while (chan) {
+ while ( (chan = ast_channel_walk_locked(chan)) != NULL) {
if (ast_test_flag(chan, AST_FLAG_MOH)) {
if (on)
local_ast_moh_start(chan, NULL);
@@ -973,7 +974,6 @@ static void moh_on_off(int on) {
ast_deactivate_generator(chan);
}
ast_mutex_unlock(&chan->lock);
- chan = ast_channel_walk_locked(chan);
}
}