mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 00:04:53 +00:00
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:
@@ -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; \
|
||||
|
Reference in New Issue
Block a user