From 9b47fe09c049ac5f686da439bca4adb2b38e83aa Mon Sep 17 00:00:00 2001 From: file Date: Wed, 13 Jun 2007 18:16:00 +0000 Subject: Merged revisions 69127 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r69127 | file | 2007-06-13 14:12:48 -0400 (Wed, 13 Jun 2007) | 2 lines Return group counting to previous behavior where you could only have one group per category. (issue #9711 reported by irroot) ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@69128 f38db490-d61c-443f-a65b-d21fe96a405b --- main/app.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'main/app.c') diff --git a/main/app.c b/main/app.c index 89fdb26d4..dbcdcac64 100644 --- a/main/app.c +++ b/main/app.c @@ -806,12 +806,16 @@ int ast_app_group_set_channel(struct ast_channel *chan, const char *data) len += strlen(category) + 1; AST_LIST_LOCK(&groups); - AST_LIST_TRAVERSE(&groups, gi, list) { - if (gi->chan == chan && !strcasecmp(gi->group, group) && (ast_strlen_zero(category) || (!ast_strlen_zero(gi->category) && !strcasecmp(gi->category, category)))) + AST_LIST_TRAVERSE_SAFE_BEGIN(&groups, gi, list) { + if ((gi->chan == chan) && ((ast_strlen_zero(category) && ast_strlen_zero(gi->category)) || (!ast_strlen_zero(gi->category) && !strcasecmp(gi->category, category)))) { + AST_LIST_REMOVE_CURRENT(&groups, list); + free(gi); break; + } } + AST_LIST_TRAVERSE_SAFE_END - if (!gi && (gi = calloc(1, len))) { + if ((gi = calloc(1, len))) { gi->chan = chan; gi->group = (char *) gi + sizeof(*gi); strcpy(gi->group, group); -- cgit v1.2.3