aboutsummaryrefslogtreecommitdiffstats
path: root/funcs
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-14 15:25:32 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-14 15:25:32 +0000
commit09896e33e13c15512345ab3680167fad2d352942 (patch)
treefa40392a547c0d8c729b10fd2b37cab9443f3174 /funcs
parentaa74a2d034c06d9ce07836c6b1435281e48238b2 (diff)
Merged revisions 69259 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r69259 | qwell | 2007-06-14 10:21:29 -0500 (Thu, 14 Jun 2007) | 12 lines 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. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@69260 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_groupcount.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/funcs/func_groupcount.c b/funcs/func_groupcount.c
index a72277a36..883920112 100644
--- a/funcs/func_groupcount.c
+++ b/funcs/func_groupcount.c
@@ -48,7 +48,7 @@ static int group_count_function_read(struct ast_channel *chan, const char *cmd,
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;
@@ -102,15 +102,13 @@ static int group_function_read(struct ast_channel *chan, const char *cmd,
ast_app_group_list_rdlock();
- 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)
@@ -160,23 +158,21 @@ static int group_list_function_read(struct ast_channel *chan, const char *cmd,
ast_app_group_list_rdlock();
- 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();