make state_handler macros not let you install the same one more than once

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13111 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-04-21 22:51:28 +00:00
parent 130d3f3828
commit d2a2be5d6a
1 changed files with 2 additions and 0 deletions

View File

@ -181,6 +181,8 @@ extern switch_io_event_hooks_t switch_core_session_get_event_hooks(switch_core_s
{ \
switch_io_event_hook_##_NAME##_t *hook, *ptr; \
assert(_NAME != NULL); \
for (ptr = session->event_hooks._NAME; ptr && ptr->next; ptr = ptr->next) \
if (ptr->_NAME == _NAME) return SWITCH_STATUS_FALSE; \
if ((hook = switch_core_session_alloc(session, sizeof(*hook))) != 0) { \
hook->_NAME = _NAME ; \
if (! session->event_hooks._NAME ) { \