add direct object unlink macro to ASTOBJ api

various minor cleanups in chan_sip


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2005-05-01 18:08:14 +00:00
parent fc619c1402
commit 7d4b53c57a
2 changed files with 128 additions and 111 deletions

View File

@@ -187,6 +187,26 @@ extern "C" {
ASTOBJ_CONTAINER_UNLOCK(container); \
} while(0)
#define ASTOBJ_CONTAINER_UNLINK(container,obj) \
({ \
typeof((container)->head) found = NULL; \
typeof((container)->head) prev = NULL; \
ASTOBJ_CONTAINER_TRAVERSE(container, !found, do { \
if (iterator == obj) { \
found = iterator; \
found->next[0] = NULL; \
ASTOBJ_CONTAINER_WRLOCK(container); \
if (prev) \
prev->next[0] = next; \
else \
(container)->head = next; \
ASTOBJ_CONTAINER_UNLOCK(container); \
} \
prev = iterator; \
} while (0)); \
found; \
})
#define ASTOBJ_CONTAINER_FIND_UNLINK(container,namestr) \
({ \
typeof((container)->head) found = NULL; \