diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-05-01 18:08:14 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-05-01 18:08:14 +0000 |
commit | 6622001d6d3a0026b1c82238acd0f4c0d1c7b228 (patch) | |
tree | 46ce69e0ebca6987fa5c4e9773a5d743b41ba7e4 /include | |
parent | 3f1ffd2fa49b85686bb2694576e552178d2d394d (diff) |
add direct object unlink macro to ASTOBJ api
various minor cleanups in chan_sip
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5539 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rwxr-xr-x | include/asterisk/astobj.h | 20 |
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; \ |