]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Return group counting to previous behavior where you could only have one group per...
authorJoshua Colp <jcolp@digium.com>
Wed, 13 Jun 2007 18:12:48 +0000 (18:12 +0000)
committerJoshua Colp <jcolp@digium.com>
Wed, 13 Jun 2007 18:12:48 +0000 (18:12 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@69127 65c4cc65-6c06-0410-ace0-fbb531ad65f3

app.c

diff --git a/app.c b/app.c
index f997752480f55f6b1a5cdadc4db0884b69d27730..33b318dd2c470c1e822f03dd1b5b5efb67661efe 100644 (file)
--- a/app.c
+++ b/app.c
@@ -1047,12 +1047,16 @@ int ast_app_group_set_channel(struct ast_channel *chan, 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);