[asterisk-commits] rmudgett: branch 10 r329334 - in /branches/10: ./ main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 22 16:14:25 CDT 2011


Author: rmudgett
Date: Fri Jul 22 16:14:22 2011
New Revision: 329334

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=329334
Log:
Make use less redundant loop construct for iterating over hints.

Modified:
    branches/10/   (props changed)
    branches/10/main/pbx.c

Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/10/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/main/pbx.c?view=diff&rev=329334&r1=329333&r2=329334
==============================================================================
--- branches/10/main/pbx.c (original)
+++ branches/10/main/pbx.c Fri Jul 22 16:14:22 2011
@@ -6084,7 +6084,7 @@
 	ast_cli(a->fd, "\n    -= Registered Asterisk Dial Plan Hints =-\n");
 
 	i = ao2_iterator_init(hints, 0);
-	for (hint = ao2_iterator_next(&i); hint; ao2_ref(hint, -1), hint = ao2_iterator_next(&i)) {
+	for (; (hint = ao2_iterator_next(&i)); ao2_ref(hint, -1)) {
 		ao2_lock(hint);
 		if (!hint->exten) {
 			/* The extension has already been destroyed */
@@ -6123,7 +6123,7 @@
 
 	/* walk through all hints */
 	i = ao2_iterator_init(hints, 0);
-	for (hint = ao2_iterator_next(&i); hint; ao2_ref(hint, -1), hint = ao2_iterator_next(&i)) {
+	for (; (hint = ao2_iterator_next(&i)); ao2_ref(hint, -1)) {
 		ao2_lock(hint);
 		if (!hint->exten) {
 			/* The extension has already been destroyed */
@@ -6172,7 +6172,7 @@
 
 	extenlen = strlen(a->argv[3]);
 	i = ao2_iterator_init(hints, 0);
-	for (hint = ao2_iterator_next(&i); hint; ao2_ref(hint, -1), hint = ao2_iterator_next(&i)) {
+	for (; (hint = ao2_iterator_next(&i)); ao2_ref(hint, -1)) {
 		ao2_lock(hint);
 		if (!hint->exten) {
 			/* The extension has already been destroyed */
@@ -7414,7 +7414,7 @@
 
 	/* preserve all watchers for hints */
 	i = ao2_iterator_init(hints, AO2_ITERATOR_DONTLOCK);
-	for (hint = ao2_iterator_next(&i); hint; ao2_ref(hint, -1), hint = ao2_iterator_next(&i)) {
+	for (; (hint = ao2_iterator_next(&i)); ao2_ref(hint, -1)) {
 		if (ao2_container_count(hint->callbacks)) {
 			ao2_lock(hint);
 			if (!hint->exten) {
@@ -10207,7 +10207,7 @@
 	}
 
 	i = ao2_iterator_init(hints, 0);
-	for (hint = ao2_iterator_next(&i); hint; ao2_ref(hint, -1), hint = ao2_iterator_next(&i)) {
+	for (; (hint = ao2_iterator_next(&i)); ao2_ref(hint, -1)) {
 		watchers = ao2_container_count(hint->callbacks);
 		data_hint = ast_data_add_node(data_root, "hint");
 		if (!data_hint) {




More information about the asterisk-commits mailing list