summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2005-05-01 18:08:14 +0000
committerKevin P. Fleming <kpfleming@digium.com>2005-05-01 18:08:14 +0000
commit7d4b53c57a9a4301101179594cac666f3fd97b86 (patch)
tree46ce69e0ebca6987fa5c4e9773a5d743b41ba7e4 /include
parentfc619c1402506815105be1fae4c7395ac2da7459 (diff)
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
Diffstat (limited to 'include')
-rwxr-xr-xinclude/asterisk/astobj.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/asterisk/astobj.h b/include/asterisk/astobj.h
index a4fa3e77a..72bead8fc 100755
--- a/include/asterisk/astobj.h
+++ b/include/asterisk/astobj.h
@@ -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; \