[asterisk-commits] russell: trunk r47206 - /trunk/pbx/pbx_dundi.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Nov 4 14:54:37 MST 2006


Author: russell
Date: Sat Nov  4 15:54:37 2006
New Revision: 47206

URL: http://svn.digium.com/view/asterisk?rev=47206&view=rev
Log:
simplify a couple of loops

Modified:
    trunk/pbx/pbx_dundi.c

Modified: trunk/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_dundi.c?rev=47206&r1=47205&r2=47206&view=diff
==============================================================================
--- trunk/pbx/pbx_dundi.c (original)
+++ trunk/pbx/pbx_dundi.c Sat Nov  4 15:54:37 2006
@@ -3610,19 +3610,16 @@
 	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();
 	}



More information about the asterisk-commits mailing list