diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-04 21:54:37 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-04 21:54:37 +0000 |
commit | bb3e3ea3a5a7b1013614768458b3124cf309f940 (patch) | |
tree | f7117e69a832271828b9a5e8307444165d01d8c7 /pbx | |
parent | 892aaef06caffef61a60974d0962a7ef71421dfb (diff) |
simplify a couple of loops
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47206 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rw-r--r-- | pbx/pbx_dundi.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index 798beca16..c3a98ef01 100644 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -3610,19 +3610,16 @@ static void dundi_precache_full(void) AST_LIST_TRAVERSE(&mappings, cur, list) { ast_log(LOG_NOTICE, "Should precache context '%s'\n", cur->dcontext); ast_lock_contexts(); - con = ast_walk_contexts(NULL); - while (con) { - if (!strcasecmp(cur->lcontext, ast_get_context_name(con))) { - /* Found the match, now queue them all up */ - ast_lock_context(con); - e = ast_walk_context_extensions(con, NULL); - while (e) { - reschedule_precache(ast_get_extension_name(e), cur->dcontext, 0); - e = ast_walk_context_extensions(con, e); - } - ast_unlock_context(con); - } - con = ast_walk_contexts(con); + con = NULL; + while ((con = ast_walk_contexts(con))) { + if (strcasecmp(cur->lcontext, ast_get_context_name(con))) + continue; + /* Found the match, now queue them all up */ + ast_lock_context(con); + e = NULL; + while ((e = ast_walk_context_extensions(con, e))) + reschedule_precache(ast_get_extension_name(e), cur->dcontext, 0); + ast_unlock_context(con); } ast_unlock_contexts(); } |