convert this code to a more efficient idiom
authorKevin P. Fleming <kpfleming@digium.com>
Thu, 8 Nov 2007 20:39:41 +0000 (20:39 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Thu, 8 Nov 2007 20:39:41 +0000 (20:39 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89118 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_features.c

index f352afa..98e14c0 100644 (file)
@@ -568,13 +568,11 @@ static int unload_module(void)
        if (!AST_LIST_LOCK(&features))
                return -1;
        /* Hangup all interfaces if they have an owner */
        if (!AST_LIST_LOCK(&features))
                return -1;
        /* Hangup all interfaces if they have an owner */
-       AST_LIST_TRAVERSE_SAFE_BEGIN(&features, p, list) {
+       while ((p = AST_LIST_REMOVE_HEAD(&features, list))) {
                if (p->owner)
                        ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
                if (p->owner)
                        ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
-               AST_LIST_REMOVE_CURRENT(list);
                ast_free(p);
        }
                ast_free(p);
        }
-       AST_LIST_TRAVERSE_SAFE_END
        AST_LIST_UNLOCK(&features);
        
        return 0;
        AST_LIST_UNLOCK(&features);
        
        return 0;