Author: anthm Date: Tue Apr 21 17:51:28 2009 New Revision: 13111 Log: make state_handler macros not let you install the same one more than once Modified: freeswitch/trunk/src/include/switch_core_event_hook.h Modified: freeswitch/trunk/src/include/switch_core_event_hook.h ============================================================================== --- freeswitch/trunk/src/include/switch_core_event_hook.h (original) +++ freeswitch/trunk/src/include/switch_core_event_hook.h Tue Apr 21 17:51:28 2009 @@ -181,6 +181,8 @@ { \ 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 ) { \