From: Russell Bryant Date: Sat, 4 Nov 2006 21:54:37 +0000 (+0000) Subject: simplify a couple of loops X-Git-Tag: 1.6.0-beta1~3^2~4111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=121bd75fcc615fe303909e35790b9a4c2aa80476;p=thirdparty%2Fasterisk.git simplify a couple of loops git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47206 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index 798beca16d..c3a98ef011 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(); }