File: | src/switch_core_event_hook.c |
Location: | line 44, column 2 |
Description: | Access to field 'next' results in a dereference of a null pointer (loaded from variable 'ptr') |
1 | /* | ||||||||
2 | * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application | ||||||||
3 | * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org> | ||||||||
4 | * | ||||||||
5 | * Version: MPL 1.1 | ||||||||
6 | * | ||||||||
7 | * The contents of this file are subject to the Mozilla Public License Version | ||||||||
8 | * 1.1 (the "License"); you may not use this file except in compliance with | ||||||||
9 | * the License. You may obtain a copy of the License at | ||||||||
10 | * http://www.mozilla.org/MPL/ | ||||||||
11 | * | ||||||||
12 | * Software distributed under the License is distributed on an "AS IS" basis, | ||||||||
13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | ||||||||
14 | * for the specific language governing rights and limitations under the | ||||||||
15 | * License. | ||||||||
16 | * | ||||||||
17 | * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application | ||||||||
18 | * | ||||||||
19 | * The Initial Developer of the Original Code is | ||||||||
20 | * Anthony Minessale II <anthm@freeswitch.org> | ||||||||
21 | * Portions created by the Initial Developer are Copyright (C) | ||||||||
22 | * the Initial Developer. All Rights Reserved. | ||||||||
23 | * | ||||||||
24 | * Contributor(s): | ||||||||
25 | * | ||||||||
26 | * Anthony Minessale II <anthm@freeswitch.org> | ||||||||
27 | * | ||||||||
28 | * switch_core_event_hook.c Core Event Hooks | ||||||||
29 | * | ||||||||
30 | */ | ||||||||
31 | #include "switch.h" | ||||||||
32 | #include "private/switch_core_pvt.h" | ||||||||
33 | |||||||||
34 | NEW_HOOK_DECL(outgoing_channel)__attribute__((visibility("default"))) switch_status_t switch_core_event_hook_add_outgoing_channel (switch_core_session_t *session, switch_outgoing_channel_hook_t outgoing_channel) { switch_io_event_hook_outgoing_channel_t * hook, *ptr; ((outgoing_channel != ((void*)0)) ? (void) (0) : __assert_fail ("outgoing_channel != ((void*)0)", "src/switch_core_event_hook.c" , 34, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks .outgoing_channel; ptr && ptr->next; ptr = ptr-> next) if (ptr->outgoing_channel == outgoing_channel) return SWITCH_STATUS_FALSE; if (ptr && ptr->outgoing_channel == outgoing_channel) return SWITCH_STATUS_FALSE; if ((hook = switch_core_perform_session_alloc(session, sizeof(*hook), "src/switch_core_event_hook.c" , (const char *)__func__, 34)) != 0) { hook->outgoing_channel = outgoing_channel ; if (! session->event_hooks.outgoing_channel ) { session->event_hooks.outgoing_channel = hook; } else { ptr->next = hook; } return SWITCH_STATUS_SUCCESS; } return SWITCH_STATUS_MEMERR; } __attribute__((visibility("default") )) switch_status_t switch_core_event_hook_remove_outgoing_channel (switch_core_session_t *session, switch_outgoing_channel_hook_t outgoing_channel) { switch_io_event_hook_outgoing_channel_t * ptr, *last = ((void*)0); ((outgoing_channel != ((void*)0)) ? ( void) (0) : __assert_fail ("outgoing_channel != ((void*)0)", "src/switch_core_event_hook.c" , 34, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks .outgoing_channel; ptr; ptr = ptr->next) { if (ptr->outgoing_channel == outgoing_channel) { if (last) { last->next = ptr->next ; } else { session->event_hooks.outgoing_channel = ptr-> next; } return SWITCH_STATUS_SUCCESS; } last = ptr; } return SWITCH_STATUS_FALSE ; } | ||||||||
35 | NEW_HOOK_DECL(receive_message)__attribute__((visibility("default"))) switch_status_t switch_core_event_hook_add_receive_message (switch_core_session_t *session, switch_receive_message_hook_t receive_message) { switch_io_event_hook_receive_message_t *hook , *ptr; ((receive_message != ((void*)0)) ? (void) (0) : __assert_fail ("receive_message != ((void*)0)", "src/switch_core_event_hook.c" , 35, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks .receive_message; ptr && ptr->next; ptr = ptr-> next) if (ptr->receive_message == receive_message) return SWITCH_STATUS_FALSE ; if (ptr && ptr->receive_message == receive_message ) return SWITCH_STATUS_FALSE; if ((hook = switch_core_perform_session_alloc (session, sizeof(*hook), "src/switch_core_event_hook.c", (const char *)__func__, 35)) != 0) { hook->receive_message = receive_message ; if (! session->event_hooks.receive_message ) { session-> event_hooks.receive_message = hook; } else { ptr->next = hook ; } return SWITCH_STATUS_SUCCESS; } return SWITCH_STATUS_MEMERR ; } __attribute__((visibility("default"))) switch_status_t switch_core_event_hook_remove_receive_message (switch_core_session_t *session, switch_receive_message_hook_t receive_message) { switch_io_event_hook_receive_message_t *ptr , *last = ((void*)0); ((receive_message != ((void*)0)) ? (void ) (0) : __assert_fail ("receive_message != ((void*)0)", "src/switch_core_event_hook.c" , 35, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks .receive_message; ptr; ptr = ptr->next) { if (ptr->receive_message == receive_message) { if (last) { last->next = ptr->next ; } else { session->event_hooks.receive_message = ptr-> next; } return SWITCH_STATUS_SUCCESS; } last = ptr; } return SWITCH_STATUS_FALSE ; } | ||||||||
36 | NEW_HOOK_DECL(receive_event)__attribute__((visibility("default"))) switch_status_t switch_core_event_hook_add_receive_event (switch_core_session_t *session, switch_receive_event_hook_t receive_event) { switch_io_event_hook_receive_event_t *hook, *ptr; ((receive_event != ((void*)0)) ? (void) (0) : __assert_fail ("receive_event != ((void*)0)", "src/switch_core_event_hook.c" , 36, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks .receive_event; ptr && ptr->next; ptr = ptr->next ) if (ptr->receive_event == receive_event) return SWITCH_STATUS_FALSE ; if (ptr && ptr->receive_event == receive_event) return SWITCH_STATUS_FALSE; if ((hook = switch_core_perform_session_alloc (session, sizeof(*hook), "src/switch_core_event_hook.c", (const char *)__func__, 36)) != 0) { hook->receive_event = receive_event ; if (! session->event_hooks.receive_event ) { session-> event_hooks.receive_event = hook; } else { ptr->next = hook ; } return SWITCH_STATUS_SUCCESS; } return SWITCH_STATUS_MEMERR ; } __attribute__((visibility("default"))) switch_status_t switch_core_event_hook_remove_receive_event (switch_core_session_t *session, switch_receive_event_hook_t receive_event) { switch_io_event_hook_receive_event_t *ptr, * last = ((void*)0); ((receive_event != ((void*)0)) ? (void) (0 ) : __assert_fail ("receive_event != ((void*)0)", "src/switch_core_event_hook.c" , 36, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks .receive_event; ptr; ptr = ptr->next) { if (ptr->receive_event == receive_event) { if (last) { last->next = ptr->next ; } else { session->event_hooks.receive_event = ptr->next ; } return SWITCH_STATUS_SUCCESS; } last = ptr; } return SWITCH_STATUS_FALSE ; } | ||||||||
37 | NEW_HOOK_DECL(state_change)__attribute__((visibility("default"))) switch_status_t switch_core_event_hook_add_state_change (switch_core_session_t *session, switch_state_change_hook_t state_change ) { switch_io_event_hook_state_change_t *hook, *ptr; ((state_change != ((void*)0)) ? (void) (0) : __assert_fail ("state_change != ((void*)0)" , "src/switch_core_event_hook.c", 37, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks.state_change; ptr && ptr ->next; ptr = ptr->next) if (ptr->state_change == state_change ) return SWITCH_STATUS_FALSE; if (ptr && ptr->state_change == state_change) return SWITCH_STATUS_FALSE; if ((hook = switch_core_perform_session_alloc (session, sizeof(*hook), "src/switch_core_event_hook.c", (const char *)__func__, 37)) != 0) { hook->state_change = state_change ; if (! session->event_hooks.state_change ) { session-> event_hooks.state_change = hook; } else { ptr->next = hook ; } return SWITCH_STATUS_SUCCESS; } return SWITCH_STATUS_MEMERR ; } __attribute__((visibility("default"))) switch_status_t switch_core_event_hook_remove_state_change (switch_core_session_t *session, switch_state_change_hook_t state_change ) { switch_io_event_hook_state_change_t *ptr, *last = ((void* )0); ((state_change != ((void*)0)) ? (void) (0) : __assert_fail ("state_change != ((void*)0)", "src/switch_core_event_hook.c" , 37, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks .state_change; ptr; ptr = ptr->next) { if (ptr->state_change == state_change) { if (last) { last->next = ptr->next; } else { session->event_hooks.state_change = ptr->next ; } return SWITCH_STATUS_SUCCESS; } last = ptr; } return SWITCH_STATUS_FALSE ; } | ||||||||
38 | NEW_HOOK_DECL(state_run)__attribute__((visibility("default"))) switch_status_t switch_core_event_hook_add_state_run (switch_core_session_t *session, switch_state_run_hook_t state_run ) { switch_io_event_hook_state_run_t *hook, *ptr; ((state_run != ((void*)0)) ? (void) (0) : __assert_fail ("state_run != ((void*)0)" , "src/switch_core_event_hook.c", 38, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks.state_run; ptr && ptr ->next; ptr = ptr->next) if (ptr->state_run == state_run ) return SWITCH_STATUS_FALSE; if (ptr && ptr->state_run == state_run) return SWITCH_STATUS_FALSE; if ((hook = switch_core_perform_session_alloc (session, sizeof(*hook), "src/switch_core_event_hook.c", (const char *)__func__, 38)) != 0) { hook->state_run = state_run ; if (! session->event_hooks.state_run ) { session->event_hooks .state_run = hook; } else { ptr->next = hook; } return SWITCH_STATUS_SUCCESS ; } return SWITCH_STATUS_MEMERR; } __attribute__((visibility( "default"))) switch_status_t switch_core_event_hook_remove_state_run (switch_core_session_t *session, switch_state_run_hook_t state_run ) { switch_io_event_hook_state_run_t *ptr, *last = ((void*)0) ; ((state_run != ((void*)0)) ? (void) (0) : __assert_fail ("state_run != ((void*)0)" , "src/switch_core_event_hook.c", 38, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks.state_run; ptr; ptr = ptr-> next) { if (ptr->state_run == state_run) { if (last) { last ->next = ptr->next; } else { session->event_hooks.state_run = ptr->next; } return SWITCH_STATUS_SUCCESS; } last = ptr ; } return SWITCH_STATUS_FALSE; } | ||||||||
39 | NEW_HOOK_DECL(read_frame)__attribute__((visibility("default"))) switch_status_t switch_core_event_hook_add_read_frame (switch_core_session_t *session, switch_read_frame_hook_t read_frame ) { switch_io_event_hook_read_frame_t *hook, *ptr; ((read_frame != ((void*)0)) ? (void) (0) : __assert_fail ("read_frame != ((void*)0)" , "src/switch_core_event_hook.c", 39, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks.read_frame; ptr && ptr ->next; ptr = ptr->next) if (ptr->read_frame == read_frame ) return SWITCH_STATUS_FALSE; if (ptr && ptr->read_frame == read_frame) return SWITCH_STATUS_FALSE; if ((hook = switch_core_perform_session_alloc (session, sizeof(*hook), "src/switch_core_event_hook.c", (const char *)__func__, 39)) != 0) { hook->read_frame = read_frame ; if (! session->event_hooks.read_frame ) { session->event_hooks .read_frame = hook; } else { ptr->next = hook; } return SWITCH_STATUS_SUCCESS ; } return SWITCH_STATUS_MEMERR; } __attribute__((visibility( "default"))) switch_status_t switch_core_event_hook_remove_read_frame (switch_core_session_t *session, switch_read_frame_hook_t read_frame ) { switch_io_event_hook_read_frame_t *ptr, *last = ((void*)0 ); ((read_frame != ((void*)0)) ? (void) (0) : __assert_fail ( "read_frame != ((void*)0)", "src/switch_core_event_hook.c", 39 , __PRETTY_FUNCTION__)); for (ptr = session->event_hooks.read_frame ; ptr; ptr = ptr->next) { if (ptr->read_frame == read_frame ) { if (last) { last->next = ptr->next; } else { session ->event_hooks.read_frame = ptr->next; } return SWITCH_STATUS_SUCCESS ; } last = ptr; } return SWITCH_STATUS_FALSE; } | ||||||||
40 | NEW_HOOK_DECL(write_frame)__attribute__((visibility("default"))) switch_status_t switch_core_event_hook_add_write_frame (switch_core_session_t *session, switch_write_frame_hook_t write_frame ) { switch_io_event_hook_write_frame_t *hook, *ptr; ((write_frame != ((void*)0)) ? (void) (0) : __assert_fail ("write_frame != ((void*)0)" , "src/switch_core_event_hook.c", 40, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks.write_frame; ptr && ptr ->next; ptr = ptr->next) if (ptr->write_frame == write_frame ) return SWITCH_STATUS_FALSE; if (ptr && ptr->write_frame == write_frame) return SWITCH_STATUS_FALSE; if ((hook = switch_core_perform_session_alloc (session, sizeof(*hook), "src/switch_core_event_hook.c", (const char *)__func__, 40)) != 0) { hook->write_frame = write_frame ; if (! session->event_hooks.write_frame ) { session-> event_hooks.write_frame = hook; } else { ptr->next = hook; } return SWITCH_STATUS_SUCCESS; } return SWITCH_STATUS_MEMERR ; } __attribute__((visibility("default"))) switch_status_t switch_core_event_hook_remove_write_frame (switch_core_session_t *session, switch_write_frame_hook_t write_frame ) { switch_io_event_hook_write_frame_t *ptr, *last = ((void*) 0); ((write_frame != ((void*)0)) ? (void) (0) : __assert_fail ("write_frame != ((void*)0)", "src/switch_core_event_hook.c" , 40, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks .write_frame; ptr; ptr = ptr->next) { if (ptr->write_frame == write_frame) { if (last) { last->next = ptr->next; } else { session->event_hooks.write_frame = ptr->next; } return SWITCH_STATUS_SUCCESS; } last = ptr; } return SWITCH_STATUS_FALSE ; } | ||||||||
41 | NEW_HOOK_DECL(video_read_frame)__attribute__((visibility("default"))) switch_status_t switch_core_event_hook_add_video_read_frame (switch_core_session_t *session, switch_video_read_frame_hook_t video_read_frame) { switch_io_event_hook_video_read_frame_t * hook, *ptr; ((video_read_frame != ((void*)0)) ? (void) (0) : __assert_fail ("video_read_frame != ((void*)0)", "src/switch_core_event_hook.c" , 41, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks .video_read_frame; ptr && ptr->next; ptr = ptr-> next) if (ptr->video_read_frame == video_read_frame) return SWITCH_STATUS_FALSE; if (ptr && ptr->video_read_frame == video_read_frame) return SWITCH_STATUS_FALSE; if ((hook = switch_core_perform_session_alloc(session, sizeof(*hook), "src/switch_core_event_hook.c" , (const char *)__func__, 41)) != 0) { hook->video_read_frame = video_read_frame ; if (! session->event_hooks.video_read_frame ) { session->event_hooks.video_read_frame = hook; } else { ptr->next = hook; } return SWITCH_STATUS_SUCCESS; } return SWITCH_STATUS_MEMERR; } __attribute__((visibility("default") )) switch_status_t switch_core_event_hook_remove_video_read_frame (switch_core_session_t *session, switch_video_read_frame_hook_t video_read_frame) { switch_io_event_hook_video_read_frame_t * ptr, *last = ((void*)0); ((video_read_frame != ((void*)0)) ? ( void) (0) : __assert_fail ("video_read_frame != ((void*)0)", "src/switch_core_event_hook.c" , 41, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks .video_read_frame; ptr; ptr = ptr->next) { if (ptr->video_read_frame == video_read_frame) { if (last) { last->next = ptr->next ; } else { session->event_hooks.video_read_frame = ptr-> next; } return SWITCH_STATUS_SUCCESS; } last = ptr; } return SWITCH_STATUS_FALSE ; } | ||||||||
42 | NEW_HOOK_DECL(video_write_frame)__attribute__((visibility("default"))) switch_status_t switch_core_event_hook_add_video_write_frame (switch_core_session_t *session, switch_video_write_frame_hook_t video_write_frame) { switch_io_event_hook_video_write_frame_t *hook, *ptr; ((video_write_frame != ((void*)0)) ? (void) (0) : __assert_fail ("video_write_frame != ((void*)0)", "src/switch_core_event_hook.c" , 42, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks .video_write_frame; ptr && ptr->next; ptr = ptr-> next) if (ptr->video_write_frame == video_write_frame) return SWITCH_STATUS_FALSE; if (ptr && ptr->video_write_frame == video_write_frame) return SWITCH_STATUS_FALSE; if ((hook = switch_core_perform_session_alloc(session, sizeof(*hook), "src/switch_core_event_hook.c" , (const char *)__func__, 42)) != 0) { hook->video_write_frame = video_write_frame ; if (! session->event_hooks.video_write_frame ) { session->event_hooks.video_write_frame = hook; } else { ptr->next = hook; } return SWITCH_STATUS_SUCCESS; } return SWITCH_STATUS_MEMERR; } __attribute__((visibility("default") )) switch_status_t switch_core_event_hook_remove_video_write_frame (switch_core_session_t *session, switch_video_write_frame_hook_t video_write_frame) { switch_io_event_hook_video_write_frame_t *ptr, *last = ((void*)0); ((video_write_frame != ((void*)0)) ? (void) (0) : __assert_fail ("video_write_frame != ((void*)0)" , "src/switch_core_event_hook.c", 42, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks.video_write_frame; ptr; ptr = ptr->next) { if (ptr->video_write_frame == video_write_frame ) { if (last) { last->next = ptr->next; } else { session ->event_hooks.video_write_frame = ptr->next; } return SWITCH_STATUS_SUCCESS ; } last = ptr; } return SWITCH_STATUS_FALSE; } | ||||||||
43 | NEW_HOOK_DECL(kill_channel)__attribute__((visibility("default"))) switch_status_t switch_core_event_hook_add_kill_channel (switch_core_session_t *session, switch_kill_channel_hook_t kill_channel ) { switch_io_event_hook_kill_channel_t *hook, *ptr; ((kill_channel != ((void*)0)) ? (void) (0) : __assert_fail ("kill_channel != ((void*)0)" , "src/switch_core_event_hook.c", 43, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks.kill_channel; ptr && ptr ->next; ptr = ptr->next) if (ptr->kill_channel == kill_channel ) return SWITCH_STATUS_FALSE; if (ptr && ptr->kill_channel == kill_channel) return SWITCH_STATUS_FALSE; if ((hook = switch_core_perform_session_alloc (session, sizeof(*hook), "src/switch_core_event_hook.c", (const char *)__func__, 43)) != 0) { hook->kill_channel = kill_channel ; if (! session->event_hooks.kill_channel ) { session-> event_hooks.kill_channel = hook; } else { ptr->next = hook ; } return SWITCH_STATUS_SUCCESS; } return SWITCH_STATUS_MEMERR ; } __attribute__((visibility("default"))) switch_status_t switch_core_event_hook_remove_kill_channel (switch_core_session_t *session, switch_kill_channel_hook_t kill_channel ) { switch_io_event_hook_kill_channel_t *ptr, *last = ((void* )0); ((kill_channel != ((void*)0)) ? (void) (0) : __assert_fail ("kill_channel != ((void*)0)", "src/switch_core_event_hook.c" , 43, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks .kill_channel; ptr; ptr = ptr->next) { if (ptr->kill_channel == kill_channel) { if (last) { last->next = ptr->next; } else { session->event_hooks.kill_channel = ptr->next ; } return SWITCH_STATUS_SUCCESS; } last = ptr; } return SWITCH_STATUS_FALSE ; } | ||||||||
44 | NEW_HOOK_DECL(send_dtmf)__attribute__((visibility("default"))) switch_status_t switch_core_event_hook_add_send_dtmf (switch_core_session_t *session, switch_send_dtmf_hook_t send_dtmf ) { switch_io_event_hook_send_dtmf_t *hook, *ptr; ((send_dtmf != ((void*)0)) ? (void) (0) : __assert_fail ("send_dtmf != ((void*)0)" , "src/switch_core_event_hook.c", 44, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks.send_dtmf; ptr && ptr ->next; ptr = ptr->next) if (ptr->send_dtmf == send_dtmf ) return SWITCH_STATUS_FALSE; if (ptr && ptr->send_dtmf == send_dtmf) return SWITCH_STATUS_FALSE; if ((hook = switch_core_perform_session_alloc (session, sizeof(*hook), "src/switch_core_event_hook.c", (const char *)__func__, 44)) != 0) { hook->send_dtmf = send_dtmf ; if (! session->event_hooks.send_dtmf ) { session->event_hooks .send_dtmf = hook; } else { ptr->next = hook; } return SWITCH_STATUS_SUCCESS ; } return SWITCH_STATUS_MEMERR; } __attribute__((visibility( "default"))) switch_status_t switch_core_event_hook_remove_send_dtmf (switch_core_session_t *session, switch_send_dtmf_hook_t send_dtmf ) { switch_io_event_hook_send_dtmf_t *ptr, *last = ((void*)0) ; ((send_dtmf != ((void*)0)) ? (void) (0) : __assert_fail ("send_dtmf != ((void*)0)" , "src/switch_core_event_hook.c", 44, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks.send_dtmf; ptr; ptr = ptr-> next) { if (ptr->send_dtmf == send_dtmf) { if (last) { last ->next = ptr->next; } else { session->event_hooks.send_dtmf = ptr->next; } return SWITCH_STATUS_SUCCESS; } last = ptr ; } return SWITCH_STATUS_FALSE; } | ||||||||
Within the expansion of the macro 'NEW_HOOK_DECL':
| |||||||||
45 | NEW_HOOK_DECL(recv_dtmf)__attribute__((visibility("default"))) switch_status_t switch_core_event_hook_add_recv_dtmf (switch_core_session_t *session, switch_recv_dtmf_hook_t recv_dtmf ) { switch_io_event_hook_recv_dtmf_t *hook, *ptr; ((recv_dtmf != ((void*)0)) ? (void) (0) : __assert_fail ("recv_dtmf != ((void*)0)" , "src/switch_core_event_hook.c", 45, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks.recv_dtmf; ptr && ptr ->next; ptr = ptr->next) if (ptr->recv_dtmf == recv_dtmf ) return SWITCH_STATUS_FALSE; if (ptr && ptr->recv_dtmf == recv_dtmf) return SWITCH_STATUS_FALSE; if ((hook = switch_core_perform_session_alloc (session, sizeof(*hook), "src/switch_core_event_hook.c", (const char *)__func__, 45)) != 0) { hook->recv_dtmf = recv_dtmf ; if (! session->event_hooks.recv_dtmf ) { session->event_hooks .recv_dtmf = hook; } else { ptr->next = hook; } return SWITCH_STATUS_SUCCESS ; } return SWITCH_STATUS_MEMERR; } __attribute__((visibility( "default"))) switch_status_t switch_core_event_hook_remove_recv_dtmf (switch_core_session_t *session, switch_recv_dtmf_hook_t recv_dtmf ) { switch_io_event_hook_recv_dtmf_t *ptr, *last = ((void*)0) ; ((recv_dtmf != ((void*)0)) ? (void) (0) : __assert_fail ("recv_dtmf != ((void*)0)" , "src/switch_core_event_hook.c", 45, __PRETTY_FUNCTION__)); for (ptr = session->event_hooks.recv_dtmf; ptr; ptr = ptr-> next) { if (ptr->recv_dtmf == recv_dtmf) { if (last) { last ->next = ptr->next; } else { session->event_hooks.recv_dtmf = ptr->next; } return SWITCH_STATUS_SUCCESS; } last = ptr ; } return SWITCH_STATUS_FALSE; } | ||||||||
46 | |||||||||
47 | /* For Emacs: | ||||||||
48 | * Local Variables: | ||||||||
49 | * mode:c | ||||||||
50 | * indent-tabs-mode:t | ||||||||
51 | * tab-width:4 | ||||||||
52 | * c-basic-offset:4 | ||||||||
53 | * End: | ||||||||
54 | * For VIM: | ||||||||
55 | * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: | ||||||||
56 | */ |