From: Travis Cross Date: Mon, 26 May 2014 16:19:34 +0000 (+0000) Subject: mod_fifo: Remove reimplementation of strchr() X-Git-Tag: v1.4.5~2^2~14^2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e6199eace5903a952ae993b3797fe612d1db6c1;p=thirdparty%2Ffreeswitch.git mod_fifo: Remove reimplementation of strchr() --- 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;