From 3e6199eace5903a952ae993b3797fe612d1db6c1 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 26 May 2014 16:19:34 +0000 Subject: [PATCH] mod_fifo: Remove reimplementation of strchr() --- src/mod/applications/mod_fifo/mod_fifo.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 31bcbec9bc..d6a2159897 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -447,16 +447,6 @@ static int sql2str_callback(void *pArg, int argc, char **argv, char **columnName return 0; } -static switch_bool_t match_key(const char *caller_exit_key, char key) -{ - while (caller_exit_key && *caller_exit_key) { - if (*caller_exit_key++ == key) { - return SWITCH_TRUE; - } - } - return SWITCH_FALSE; -} - /*! \brief Handler for consumer DTMF * * When `fifo_consumer_exit_key` is pressed by the consumer we hangup @@ -522,7 +512,7 @@ static switch_status_t moh_on_dtmf(switch_core_session_t *session, void *input, switch_channel_t *channel = switch_core_session_get_channel(session); const char *caller_exit_key = switch_channel_get_variable(channel, "fifo_caller_exit_key"); - if (match_key(caller_exit_key, dtmf->digit)) { + if (caller_exit_key && dtmf->digit && strchr(caller_exit_key, dtmf->digit)) { char *bp = buf; *bp = dtmf->digit; return SWITCH_STATUS_BREAK; @@ -625,7 +615,7 @@ static switch_status_t caller_read_frame_callback(switch_core_session_t *session status = switch_ivr_play_file(session, NULL, cd->list[cd->index], &args); - if (match_key(cd->exit_key, *buf)) { + if (cd->exit_key && *buf && strchr(cd->exit_key, *buf)) { cd->abort = 1; return SWITCH_STATUS_BREAK; } @@ -2781,7 +2771,7 @@ SWITCH_STANDARD_APP(fifo_function) goto abort; } - if (match_key(caller_exit_key, *buf)) { + if (caller_exit_key && *buf && strchr(caller_exit_key, *buf)) { switch_channel_set_variable(channel, "fifo_caller_exit_key", (char *)buf); aborted = 1; goto abort;