]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make state_handler macros not let you install the same one more than once
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 21 Apr 2009 22:51:28 +0000 (22:51 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 21 Apr 2009 22:51:28 +0000 (22:51 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13111 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_core_event_hook.h

index ca78eadb363680306405069849825b88b45344cb..20f7a1766db82f4485b173a98be340240f4c7ac8 100644 (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 ) {                                            \