Merge remainder of kpfleming's astobj patch (bug #3183)
authorMark Spencer <markster@digium.com>
Wed, 29 Dec 2004 07:50:15 +0000 (07:50 +0000)
committerMark Spencer <markster@digium.com>
Wed, 29 Dec 2004 07:50:15 +0000 (07:50 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4582 65c4cc65-6c06-0410-ace0-fbb531ad65f3

include/asterisk/astobj.h

index 1626540..a70cf70 100755 (executable)
@@ -179,6 +179,7 @@ extern "C" {
                while((iterator = (container)->head)) { \
                        (container)->head = (iterator)->next[0]; \
                        ASTOBJ_DESTROY(iterator,destructor); \
+                       ASTOBJ_UNREF(iterator,destructor); \
                } \
                ASTOBJ_CONTAINER_UNLOCK(container); \
        } while(0)
@@ -190,7 +191,7 @@ extern "C" {
                ASTOBJ_CONTAINER_TRAVERSE(container, do { \
                        ASTOBJ_RDLOCK(iterator); \
                        if (!(comparefunc(iterator->field, (data)))) { \
-                               found = ASTOBJ_REF(iterator); \
+                               found = iterator; \
                                ASTOBJ_CONTAINER_WRLOCK(container); \
                                if (prev) \
                                        prev->next[0] = next; \
@@ -232,7 +233,7 @@ extern "C" {
        do { \
                ASTOBJ_CONTAINER_WRLOCK(container); \
                (newobj)->next[0] = (container)->head; \
-               (container)->head = (newobj); \
+               (container)->head = ASTOBJ_REF(newobj); \
                ASTOBJ_CONTAINER_UNLOCK(container); \
        } while(0)