[asterisk-commits] qwell: branch 1.4 r69259 - in /branches/1.4: ./ funcs/func_groupcount.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jun 14 08:21:30 MST 2007


Author: qwell
Date: Thu Jun 14 10:21:29 2007
New Revision: 69259

URL: http://svn.digium.com/view/asterisk?view=rev&rev=69259
Log:
Merged revisions 69258 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r69258 | qwell | 2007-06-14 10:15:53 -0500 (Thu, 14 Jun 2007) | 4 lines

Change a quite broken while loop to a for loop, so "continue;" works as expected instead of eating 99% CPU...

Issue 9966, patch by me.

........

Modified:
    branches/1.4/   (props changed)
    branches/1.4/funcs/func_groupcount.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/funcs/func_groupcount.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/funcs/func_groupcount.c?view=diff&rev=69259&r1=69258&r2=69259
==============================================================================
--- branches/1.4/funcs/func_groupcount.c (original)
+++ branches/1.4/funcs/func_groupcount.c Thu Jun 14 10:21:29 2007
@@ -47,7 +47,7 @@
 
 	if ((count = ast_app_group_get_count(group, category)) == -1)
 		ast_log(LOG_NOTICE, "No group could be found for channel '%s'\n", chan->name);
-        else
+	else
 		snprintf(buf, len, "%d", count);
 
 	return 0;
@@ -101,15 +101,13 @@
 	
 	ast_app_group_list_lock();
 	
-	gi = ast_app_group_list_head();
-	while (gi) {
+	for (gi = ast_app_group_list_head(); gi; gi = AST_LIST_NEXT(gi, list)) {
 		if (gi->chan != chan)
 			continue;
 		if (ast_strlen_zero(data))
 			break;
 		if (!ast_strlen_zero(gi->category) && !strcasecmp(gi->category, data))
 			break;
-		gi = AST_LIST_NEXT(gi, list);
 	}
 	
 	if (gi)
@@ -159,23 +157,21 @@
 
 	ast_app_group_list_lock();
 
-	gi = ast_app_group_list_head();
-	while (gi) {
+	for (gi = ast_app_group_list_head(); gi; gi = AST_LIST_NEXT(gi, list)) {
 		if (gi->chan != chan)
 			continue;
 		if (!ast_strlen_zero(tmp1)) {
 			ast_copy_string(tmp2, tmp1, sizeof(tmp2));
 			if (!ast_strlen_zero(gi->category))
 				snprintf(tmp1, sizeof(tmp1), "%s %s@%s", tmp2, gi->group, gi->category);
-                        else
+			else
 				snprintf(tmp1, sizeof(tmp1), "%s %s", tmp2, gi->group);
 		} else {
 			if (!ast_strlen_zero(gi->category))
 				snprintf(tmp1, sizeof(tmp1), "%s@%s", gi->group, gi->category);
-                        else
+			else
 				snprintf(tmp1, sizeof(tmp1), "%s", gi->group);
 		}
-		gi = AST_LIST_NEXT(gi, list);
 	}
 	
 	ast_app_group_list_unlock();



More information about the asterisk-commits mailing list