]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Fix dead nested assignments in various modules
authorAndrey Volk <andywolk@gmail.com>
Wed, 12 Jan 2022 13:30:34 +0000 (16:30 +0300)
committerAndrey Volk <andywolk@gmail.com>
Tue, 9 Aug 2022 20:20:52 +0000 (23:20 +0300)
34 files changed:
libs/iksemel/src/stream.c
libs/libvpx/vpx_dsp/x86/avg_intrin_avx2.c
libs/libvpx/vpx_dsp/x86/avg_intrin_sse2.c
src/mod/applications/mod_directory/mod_directory.c
src/mod/applications/mod_dptools/mod_dptools.c
src/mod/applications/mod_expr/exprilfs.h
src/mod/applications/mod_fifo/mod_fifo.c
src/mod/applications/mod_hash/mod_hash.c
src/mod/applications/mod_httapi/mod_httapi.c
src/mod/applications/mod_oreka/mod_oreka.c
src/mod/applications/mod_redis/credis.c
src/mod/applications/mod_rss/mod_rss.c
src/mod/applications/mod_signalwire/mod_signalwire.c
src/mod/applications/mod_snom/mod_snom.c
src/mod/applications/mod_soundtouch/mod_soundtouch.cpp
src/mod/applications/mod_spandsp/mod_spandsp_fax.c
src/mod/applications/mod_spandsp/udptl.c
src/mod/applications/mod_spy/mod_spy.c
src/mod/applications/mod_stress/mod_stress.cpp
src/mod/applications/mod_translate/mod_translate.c
src/mod/applications/mod_voicemail/mod_voicemail.c
src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c
src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c
src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/mod/endpoints/mod_portaudio/mod_portaudio.c
src/mod/endpoints/mod_skinny/mod_skinny.c
src/mod/event_handlers/mod_event_socket/mod_event_socket.c
src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c
src/mod/event_handlers/mod_rayo/xmpp_streams.c
src/mod/formats/mod_local_stream/mod_local_stream.c
src/mod/formats/mod_tone_stream/mod_tone_stream.c
src/mod/languages/mod_lua/mod_lua.cpp
src/mod/languages/mod_python3/freeswitch_python.cpp
src/mod/languages/mod_python3/mod_python3.c

index e05e5d06ef6fd1b0aa02678735d304821bdc6fe8..f304f67c64d417b93451dfef39c2905c0ffd9dc3 100644 (file)
@@ -879,11 +879,11 @@ iks_send_raw (iksparser *prs, const char *xmlstr)
        } else
 #elif HAVE_SSL
        if (data->flags & SF_SECURE) {
-               int r, err;
+               int r;
 
                do {
                        r = SSL_write(data->ssl, xmlstr, strlen (xmlstr));
-               } while (r == -1 && (err = SSL_get_error(data->ssl, r)) == SSL_ERROR_WANT_WRITE);
+               } while (r == -1 && SSL_get_error(data->ssl, r) == SSL_ERROR_WANT_WRITE);
                
                if (r < 0) {
                        return IKS_NET_RWERR;
index 3f4f577a21dcd8b216c336de7cbc04012810e810..ac33e160b96d3a3bdeed704116e172361ee4e089 100644 (file)
@@ -305,6 +305,7 @@ static void hadamard_8x8x2_avx2(const int16_t *src_diff, ptrdiff_t src_stride,
   src[5] = _mm256_loadu_si256((const __m256i *)(src_diff += src_stride));
   src[6] = _mm256_loadu_si256((const __m256i *)(src_diff += src_stride));
   src[7] = _mm256_loadu_si256((const __m256i *)(src_diff += src_stride));
+  (void)src_diff;
 
   hadamard_col8x2_avx2(src, 0);
   hadamard_col8x2_avx2(src, 1);
index 5aba903a2ddff355e99bc4e5188fea5ba58b2916..45bfefe08a8f0942bbe95f3aae1bfb351b4d040d 100644 (file)
@@ -276,6 +276,7 @@ static INLINE void hadamard_8x8_sse2(const int16_t *src_diff,
   src[5] = _mm_load_si128((const __m128i *)(src_diff += src_stride));
   src[6] = _mm_load_si128((const __m128i *)(src_diff += src_stride));
   src[7] = _mm_load_si128((const __m128i *)(src_diff += src_stride));
+  (void)src_diff;
 
   hadamard_col8_sse2(src, 0);
   hadamard_col8_sse2(src, 1);
index 3046558c5d297703eed092cde8fe46b92a4236dc..fc46e478da682e61c9f46d43616579c851ad9aec 100644 (file)
@@ -953,7 +953,6 @@ switch_status_t navigate_entrys(switch_core_session_t *session, dir_profile_t *p
 SWITCH_STANDARD_APP(directory_function)
 {
        switch_channel_t *channel = switch_core_session_get_channel(session);
-       int argc = 0;
        char *argv[6] = { 0 };
        char *mydata = NULL;
        const char *profile_name = NULL;
@@ -975,7 +974,7 @@ SWITCH_STANDARD_APP(directory_function)
        }
 
        mydata = switch_core_session_strdup(session, data);
-       if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) {
+       if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) < 2) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Not enough args [%s]\n", data);
                return;
        }
index b9ef0708d8e1175b0f3e97460e4e479a8f23275d..afe6cbef68a265a87fa9f51d97310eda57bd423f 100644 (file)
@@ -1459,7 +1459,6 @@ SWITCH_STANDARD_APP(wait_for_video_ready_function)
 SWITCH_STANDARD_APP(presence_function)
 {
        char *argv[6] = { 0 };
-       int argc;
        char *mydata = NULL;
        switch_channel_t *channel = switch_core_session_get_channel(session);
 
@@ -1468,7 +1467,7 @@ SWITCH_STANDARD_APP(presence_function)
                return;
        }
 
-       if ((argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]))) < 2) {
+       if (switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0])) < 2) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID ARGS!\n");
                return;
        }
index f89eadfadcd2bc24ef96b4106d988082c3c72b8e..e881b68d8c332402a5d8c1e91e03338dffb27317 100644 (file)
@@ -563,10 +563,12 @@ case EXPR_NODEFUNC_RECTTOPOLA:
                tmp = atan2(d2, d1);
                EXPR_CHECK_ERR();
 
-               if (tmp < 0.0)
+               if (tmp < 0.0) {
                        *val = tmp = (2.0 * M_PI);
-               else
+                       (void)tmp;
+               } else {
                        *val = tmp;
+               }
        } else
                return err;
 
index 724d1dd24fbbefa2c2d57226c076541a97e21111..304996981a0e28890f41b37ca0992a39988a08fe 100644 (file)
@@ -2353,7 +2353,6 @@ SWITCH_STANDARD_API(fifo_check_bridge_function)
 SWITCH_STANDARD_API(fifo_add_outbound_function)
 {
        char *data = NULL, *argv[4] = { 0 };
-       int argc;
        uint32_t priority = 0;
 
        if (zstr(cmd)) {
@@ -2362,7 +2361,7 @@ SWITCH_STANDARD_API(fifo_add_outbound_function)
 
        data = strdup(cmd);
 
-       if ((argc = switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2 || !argv[0]) {
+       if (switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) < 2 || !argv[0]) {
                goto fail;
        }
 
index 70bffd18e1dcca196d4c7200ed7279cb42c2aaf2..5b987f7fa05eeaf982b02f27d90ae96bcdfd5a2d 100644 (file)
@@ -435,7 +435,7 @@ SWITCH_STANDARD_APP(hash_function)
                if (argc < 4) {
                        goto usage;
                }
-               if (!(value = switch_core_hash_find(globals.db_hash, hash_key))) {
+               if (!switch_core_hash_find(globals.db_hash, hash_key)) {
                        switch_core_hash_insert_dup(globals.db_hash, hash_key, argv[3]);
                }
 
@@ -507,7 +507,7 @@ SWITCH_STANDARD_API(hash_api_function)
                        goto usage;
                }
                switch_thread_rwlock_wrlock(globals.db_hash_rwlock);
-               if ((value = switch_core_hash_find(globals.db_hash, hash_key))) {
+               if (switch_core_hash_find(globals.db_hash, hash_key)) {
                        stream->write_function(stream, "-ERR key already exists\n");
                } else {
                        switch_core_hash_insert_dup(globals.db_hash, hash_key, argv[3]);
index 0b89fd35a7e9b54269b8974dff4fcce869c667d5..4b32d87c6d670b0f87374c48ec48685dccf44617 100644 (file)
@@ -2378,7 +2378,6 @@ static char *load_cache_data(http_file_context_t *context, const char *url)
        char digest[SWITCH_MD5_DIGEST_STRING_SIZE] = { 0 };
        char meta_buffer[1024] = "";
        int fd;
-       switch_ssize_t bytes;
 
        switch_md5_string(digest, (void *) url, strlen(url));
 
@@ -2390,7 +2389,7 @@ static char *load_cache_data(http_file_context_t *context, const char *url)
                ext = find_ext(url);
        }
 
-       if (ext && (p = strchr(ext, '?'))) {
+       if (ext && strchr(ext, '?')) {
                dext = strdup(ext);
                if ((p = strchr(dext, '?'))) {
                        *p = '\0';
@@ -2402,7 +2401,7 @@ static char *load_cache_data(http_file_context_t *context, const char *url)
        context->meta_file = switch_core_sprintf(context->pool, "%s%s%s.meta", globals.cache_path, SWITCH_PATH_SEPARATOR, digest);
 
        if (switch_file_exists(context->meta_file, context->pool) == SWITCH_STATUS_SUCCESS && ((fd = open(context->meta_file, O_RDONLY, 0)) > -1)) {
-               if ((bytes = read(fd, meta_buffer, sizeof(meta_buffer))) > 0) {
+               if (read(fd, meta_buffer, sizeof(meta_buffer)) > 0) {
                        char *p;
 
                        if ((p = strchr(meta_buffer, ':'))) {
index f3fe6763867a2e56be302ed1c5007f90292a5817..560c34f6c6abff2844e73cdf3b007646a3d68b9c 100644 (file)
@@ -583,10 +583,9 @@ SWITCH_STANDARD_APP(oreka_start_function)
        oreka_session_t *oreka = NULL;
        switch_media_bug_t *bug = NULL;
        char *argv[6];
-       int argc;
-    int flags = 0;
+       int flags = 0;
        char *lbuf = NULL;
-    const char *var;
+       const char *var;
 
        if ((oreka = (oreka_session_t *) switch_channel_get_private(channel, OREKA_PRIVATE))) {
                if (!zstr(data) && !strcasecmp(data, "stop")) {
@@ -606,14 +605,14 @@ SWITCH_STANDARD_APP(oreka_start_function)
        switch_assert(oreka);
        memset(oreka, 0, sizeof(*oreka));
 
-    oreka->mux_streams = globals.mux_streams;
+       oreka->mux_streams = globals.mux_streams;
 
-    if ((var = switch_channel_get_variable(channel, "oreka_mux_streams"))) {
-        oreka->mux_streams = switch_true(var);
-    }
+       if ((var = switch_channel_get_variable(channel, "oreka_mux_streams"))) {
+               oreka->mux_streams = switch_true(var);
+       }
 
        if (data && (lbuf = switch_core_session_strdup(session, data))
-               && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+               && switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) {
 #if 0
                if (!strncasecmp(argv[x], "server", sizeof("server"))) {
                        /* parse server=192.168.1.144 string */
@@ -623,11 +622,11 @@ SWITCH_STANDARD_APP(oreka_start_function)
 
        oreka->session = session;
 
-    if (oreka->mux_streams) {
-        flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING | SMBF_ANSWER_REQ;
-    } else {
-        flags = SMBF_READ_REPLACE | SMBF_WRITE_REPLACE | SMBF_ANSWER_REQ;
-    }
+       if (oreka->mux_streams) {
+               flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING | SMBF_ANSWER_REQ;
+       } else {
+               flags = SMBF_READ_REPLACE | SMBF_WRITE_REPLACE | SMBF_ANSWER_REQ;
+       }
 
        status = switch_core_media_bug_add(session, OREKA_BUG_NAME_READ, NULL, oreka_audio_callback, oreka, 0, flags, &bug);
 
index 58e57ce1cde28911ad7eb73b0aeaf899326cbde4..040ab3ae831313c8fe7d59920f887c0fd5923ea9 100644 (file)
@@ -367,7 +367,7 @@ static int cr_readln(REDIS rhnd, int start, char **line, int *idx)
 
 static int cr_receivemultibulk(REDIS rhnd, char *line)
 {
-  int bnum, blen, i, rc=0, idx=0;
+  int bnum, blen, i, idx=0;
 
   bnum = atoi(line);
 
@@ -381,7 +381,7 @@ static int cr_receivemultibulk(REDIS rhnd, char *line)
       return CREDIS_ERR_NOMEM;
   }
 
-  for (i = 0; bnum > 0 && (rc = cr_readln(rhnd, 0, &line, NULL)) > 0; i++, bnum--) {
+  for (i = 0; bnum > 0 && cr_readln(rhnd, 0, &line, NULL) > 0; i++, bnum--) {
     if (*(line++) != CR_BULK)
       return CREDIS_ERR_PROTOCOL;
 
@@ -389,7 +389,7 @@ static int cr_receivemultibulk(REDIS rhnd, char *line)
     if (blen == -1)
       rhnd->reply.multibulk.idxs[i] = -1;
     else {
-      if ((rc = cr_readln(rhnd, blen, &line, &idx)) != blen)
+      if (cr_readln(rhnd, blen, &line, &idx) != blen)
         return CREDIS_ERR_PROTOCOL;
 
       rhnd->reply.multibulk.idxs[i] = idx;
index 5f23024da2ce8e6adcbf22962d2cb1fa4d184af1..16cd35412b88a00d550c0a44e9ea53c0c7760276 100644 (file)
@@ -305,7 +305,7 @@ SWITCH_STANDARD_APP(rss_function)
                char cmd[3];
          main_menu:
                filename = NULL;
-               len = idx = 0;
+               len = 0;
                *cmd = '\0';
                title_txt = description_txt = rights_txt = "";
 
index 466adfa7459d07d6b069b4ad558b27e85610892a..5b0be47a91ec454feff6c0b537b34d4b69a9df6a 100644 (file)
@@ -464,7 +464,6 @@ done:
 #define SIGNALWIRE_SYNTAX "token | token-reset | adoption | adopted | reload | update | debug <level> | kslog <on|off|logfile e.g. /tmp/ks.log>"
 SWITCH_STANDARD_API(mod_signalwire_api_function)
 {
-       int argc = 0;
        char *argv[2] = { 0 };
        char *buf = NULL;
 
@@ -474,7 +473,7 @@ SWITCH_STANDARD_API(mod_signalwire_api_function)
                return SWITCH_STATUS_SUCCESS;
        }
 
-    if ((argc = switch_separate_string(buf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+    if (switch_separate_string(buf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) {
                if (!strcmp(argv[0], "token")) {
                        if (globals.adoption_token[0]) {
                                stream->write_function(stream,
index 2f706c255615b40afd03b731f2b3d8ce0ae3a1a3..b3cf2b478e91c0a33a73774439c00213de9e5189 100644 (file)
@@ -149,10 +149,9 @@ SWITCH_STANDARD_API(snom_command_api_function)
                char *ret = NULL;
                switch_cache_db_handle_t *db = NULL;
                switch_stream_handle_t apistream = { 0 };
-               switch_status_t status;
 
                SWITCH_STANDARD_STREAM(apistream);
-               if ((status = switch_api_execute("sofia_contact", argv[0], NULL, &apistream)) != SWITCH_STATUS_SUCCESS) {
+               if (switch_api_execute("sofia_contact", argv[0], NULL, &apistream) != SWITCH_STATUS_SUCCESS) {
                        stream->write_function(stream, "-ERR error executing sofia_contact\n");
                        goto end;
                }
index fc2843440b4221e4de941214a4cbd3be0d1c637a..05461bc453bf448a40245b0b3704123fba93d0d2 100644 (file)
@@ -246,7 +246,6 @@ static switch_bool_t soundtouch_callback(switch_media_bug_t *bug, void *user_dat
 SWITCH_STANDARD_APP(soundtouch_start_function)
 {
        switch_media_bug_t *bug;
-       switch_status_t status;
        switch_channel_t *channel = switch_core_session_get_channel(session);
        struct soundtouch_helper *sth;
        char *argv[6];
@@ -311,14 +310,13 @@ SWITCH_STANDARD_APP(soundtouch_start_function)
 
        sth->session = session;
 
-       if ((status = switch_core_media_bug_add(session, "soundtouch", NULL, soundtouch_callback, sth, 0,
-                                                                                       sth->send_not_recv ? SMBF_WRITE_REPLACE : SMBF_READ_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
+       if (switch_core_media_bug_add(session, "soundtouch", NULL, soundtouch_callback, sth, 0,
+                                                                                       sth->send_not_recv ? SMBF_WRITE_REPLACE : SMBF_READ_REPLACE, &bug) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure!\n");
                return;
        }
 
        switch_channel_set_private(channel, "_soundtouch_", bug);
-
 }
 
 /* API Interface Function */
@@ -327,12 +325,11 @@ SWITCH_STANDARD_API(soundtouch_api_function)
 {
        switch_core_session_t *rsession = NULL;
        switch_channel_t *channel = NULL;
-        switch_media_bug_t *bug;
-        switch_status_t status;
-        struct soundtouch_helper *sth;
+       switch_media_bug_t *bug;
+       struct soundtouch_helper *sth;
        char *mycmd = NULL;
-        int argc = 0;
-        char *argv[10] = { 0 };
+       int argc = 0;
+       char *argv[10] = { 0 };
        char *uuid = NULL;
        char *action = NULL;
        int x, n;
@@ -420,8 +417,8 @@ SWITCH_STANDARD_API(soundtouch_api_function)
 
        sth->session = rsession;
 
-       if ((status = switch_core_media_bug_add(rsession, "soundtouch", NULL, soundtouch_callback, sth, 0,
-                                                                                       sth->send_not_recv ? SMBF_WRITE_REPLACE : SMBF_READ_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
+       if (switch_core_media_bug_add(rsession, "soundtouch", NULL, soundtouch_callback, sth, 0,
+                                                                                       sth->send_not_recv ? SMBF_WRITE_REPLACE : SMBF_READ_REPLACE, &bug) != SWITCH_STATUS_SUCCESS) {
                stream->write_function(stream, "-ERR Failure!\n");
                goto done;
        } else {
index 2af4babf085c363292787ce2b11790eedbc4c6ae..8c8d0103c449301b4f3eb751fc3587a42567711a 100644 (file)
@@ -1266,32 +1266,29 @@ static t38_mode_t request_t38(pvt_t *pvt)
                insist = spandsp_globals.enable_t38_insist;
        }
 
-       if ((t38_options = switch_channel_get_private(channel, "t38_options"))) {
+       if (switch_channel_get_private(channel, "t38_options")) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
                                "%s already has T.38 data\n", switch_channel_get_name(channel));
                enabled = 0;
        }
 
-
-
        if (enabled) {
+               if (!(t38_options = switch_channel_get_private(channel, "_preconfigured_t38_options"))) {
+                       t38_options = switch_core_session_alloc(session, sizeof(*t38_options));
+                       t38_options->T38MaxBitRate = (pvt->disable_v17) ? 9600 : 14400;
+                       t38_options->T38FaxVersion = 0;
+                       t38_options->T38FaxFillBitRemoval = 1;
+                       t38_options->T38FaxTranscodingMMR = 0;
+                       t38_options->T38FaxTranscodingJBIG = 0;
+                       t38_options->T38FaxRateManagement = "transferredTCF";
+                       t38_options->T38FaxMaxBuffer = 2000;
+                       t38_options->T38FaxMaxDatagram = LOCAL_FAX_MAX_DATAGRAM;
+                       t38_options->T38FaxUdpEC = "t38UDPRedundancy";
+                       t38_options->T38VendorInfo = "0 0 0";
+               }
 
-        if (!(t38_options = switch_channel_get_private(channel, "_preconfigured_t38_options"))) {
-            t38_options = switch_core_session_alloc(session, sizeof(*t38_options));
-            t38_options->T38MaxBitRate = (pvt->disable_v17) ? 9600 : 14400;
-            t38_options->T38FaxVersion = 0;
-            t38_options->T38FaxFillBitRemoval = 1;
-            t38_options->T38FaxTranscodingMMR = 0;
-            t38_options->T38FaxTranscodingJBIG = 0;
-            t38_options->T38FaxRateManagement = "transferredTCF";
-            t38_options->T38FaxMaxBuffer = 2000;
-            t38_options->T38FaxMaxDatagram = LOCAL_FAX_MAX_DATAGRAM;
-            t38_options->T38FaxUdpEC = "t38UDPRedundancy";
-            t38_options->T38VendorInfo = "0 0 0";
-        }
-
-       switch_channel_set_private(channel, "t38_options", t38_options);
-        switch_channel_set_private(channel, "_preconfigured_t38_options", NULL);
+               switch_channel_set_private(channel, "t38_options", t38_options);
+               switch_channel_set_private(channel, "_preconfigured_t38_options", NULL);
 
                pvt->t38_mode = T38_MODE_REQUESTED;
                switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_REQ);
index aa82f953d016a0bd521d23a0eada89ca68562663..35b9f29f77a025cd0816a6b1e8655330018f6fb2 100644 (file)
@@ -188,7 +188,7 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len)
        seq_no = (buf[0] << 8) | buf[1];
        ptr += 2;
        /* Break out the primary packet */
-       if ((stat = decode_open_type(buf, len, &ptr, &msg, &msg_len)) != 0)
+       if (decode_open_type(buf, len, &ptr, &msg, &msg_len) != 0)
                return -1;
        /* Decode error_recovery */
        if (ptr + 1 > len)
@@ -290,7 +290,7 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len)
 
                /* Decode the elements */
                for (i = 0; i < entries; i++) {
-                       if ((stat = decode_open_type(buf, len, &ptr, &data, &s->rx[x].fec_len[i])) != 0)
+                       if (decode_open_type(buf, len, &ptr, &data, &s->rx[x].fec_len[i]) != 0)
                                return -1;
                        if (s->rx[x].fec_len[i] > LOCAL_FAX_MAX_DATAGRAM)
                                return -1;
index 0200ee9bdf25d576c54adf9e25aa2ff716942324..ced290f0d78221553366308ad43f7f1e42abbc97 100644 (file)
@@ -286,12 +286,11 @@ static void event_handler(switch_event_t *event)
 #define USERSPY_SYNTAX "<user@domain> [uuid]"
 SWITCH_STANDARD_APP(userspy_function)
 {
-       int argc = 0;
        char *argv[2] = { 0 };
        char *params = NULL;
 
        if (!zstr(data) && (params = switch_core_session_strdup(session, data))) {
-               if ((argc = switch_separate_string(params, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
+               if (switch_separate_string(params, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 1) {
                        switch_channel_t *channel = switch_core_session_get_channel(session);
                        char *uuid = switch_core_session_get_uuid(session);
                        switch_status_t status;
index 791ad06f893c3daf3874b7e6b28fbbc576329bad..66da2d26dc6aecd6fa3a3f3e3e7ce3d526559741 100644 (file)
@@ -197,11 +197,9 @@ static switch_bool_t stress_callback(switch_media_bug_t *bug, void *user_data, s
 SWITCH_STANDARD_APP(stress_start_function)
 {
        switch_media_bug_t *bug;
-       switch_status_t status;
        switch_channel_t *channel = switch_core_session_get_channel(session);
        struct stress_helper *sth;
        char *argv[6];
-       int argc;
        char *lbuf = NULL;
        int x = 0;
 
@@ -220,7 +218,7 @@ SWITCH_STANDARD_APP(stress_start_function)
 
 
        if (data && (lbuf = switch_core_session_strdup(session, data))
-               && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+               && switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) {
         if (!strncasecmp(argv[x], "read", 4)) {
             sth->read = 1;
         }
@@ -228,14 +226,12 @@ SWITCH_STANDARD_APP(stress_start_function)
 
        sth->session = session;
 
-       if ((status = switch_core_media_bug_add(session, "stress", NULL, stress_callback, sth, 0,
-                                                                                       sth->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
+       if (switch_core_media_bug_add(session, "stress", NULL, stress_callback, sth, 0, sth->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE, &bug) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure!\n");
                return;
        }
 
        switch_channel_set_private(channel, "_stress_", bug);
-
 }
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_stress_load)
index 3e7402c30d7d5b2a3ed1b0bd3d220c19babc5152..efbcd3f14ba75a27c713abc7db58ea181f640b34 100644 (file)
@@ -333,7 +333,6 @@ SWITCH_STANDARD_API(translate_function)
        char *translated = NULL;
        switch_event_t *event = NULL;
        char *argv[32] = { 0 };
-       int argc = 0;
 
        if (zstr(cmd)) {
                stream->write_function(stream, "USAGE: %s\n", TRANSLATE_SYNTAX);
@@ -344,7 +343,7 @@ SWITCH_STANDARD_API(translate_function)
 
        mydata = strdup(cmd);
 
-       if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+       if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) {
                if (!session) {
                        char *areacode = switch_core_get_variable("default_areacode");
                        switch_core_new_memory_pool(&pool);
index 0dc84b34ceafc93f5d177d65c177e7f3e213efce..6ece9f4f471ad021cc37ce66aaa76d2a8f71ec7e 100644 (file)
@@ -3165,7 +3165,6 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t
        char *dup = NULL, *user = NULL, *domain = NULL, *profile_name = NULL;
        switch_status_t status = SWITCH_STATUS_SUCCESS;
        int isgroup = 0, isall = 0;
-       int argc = 0;
        char *argv[6] = { 0 };
        char *box, *path, *cid_num, *cid_name;
        switch_memory_pool_t *pool = NULL;
@@ -3181,7 +3180,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t
        dup = strdup(data);
        switch_assert(dup);
 
-       if ((argc = switch_separate_string(dup, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) {
+       if (switch_separate_string(dup, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) < 2) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Not enough args [%s]\n", data);
                status = SWITCH_STATUS_FALSE;
                goto end;
@@ -3338,7 +3337,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t
                } else {
                        switch_xml_t x_group = NULL;
 
-                       if ((status = switch_xml_locate_user_in_domain(user, x_domain, &ut, &x_group)) == SWITCH_STATUS_SUCCESS) {
+                       if (switch_xml_locate_user_in_domain(user, x_domain, &ut, &x_group) == SWITCH_STATUS_SUCCESS) {
                                switch_xml_merge_user(ut, x_domain, x_group);
                                switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS);
                                status = deliver_vm(profile, ut, domain, path, 0, read_flags,
index df09429ced4bab33461a2445957c911d6e3d42c1..6e7f15428cf919ecee1b97eb0e738eb27cffcfcb 100644 (file)
@@ -440,7 +440,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dahdi_codec_load)
        switch_codec_interface_t *codec_interface;
        struct stat statbuf;
        struct dahdi_transcoder_info info = { 0 };
-       int32_t fd, res;
+       int32_t fd;
        int mpf = 20000;                        /* Algorithmic delay of 15ms with 5ms of look-ahead delay */
        int spf = 160;
        int bpfd = 320;
@@ -472,7 +472,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dahdi_codec_load)
                return SWITCH_STATUS_FALSE;
        }
 
-       for (info.tcnum = 0; !(res = ioctl(fd, DAHDI_TC_GETINFO, &info)); info.tcnum++) {
+       for (info.tcnum = 0; !ioctl(fd, DAHDI_TC_GETINFO, &info); info.tcnum++) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found dahdi transcoder name: %s\n", info.name);
                if ((info.srcfmts & DAHDI_FORMAT_ULAW) && (info.dstfmts & (DAHDI_FORMAT_G729A | DAHDI_FORMAT_G723_1))) {
                        total_encoders += info.numchannels;
index 691b640a7832933f2f0cc0d84663c87b1dc1a458..24119f6f8c37554ddf3a0da36170bf2dcbfcb767 100644 (file)
@@ -103,12 +103,11 @@ SWITCH_STANDARD_APP(avoid_function)
 
 SWITCH_STANDARD_APP(goto_function)
 {
-       int argc;
        char *argv[3] = { 0 };
        char *mydata;
 
        if (data && (mydata = switch_core_session_strdup(session, data))) {
-               if ((argc = switch_separate_string(mydata, '|', argv, (sizeof(argv) / sizeof(argv[0])))) < 1) {
+               if (switch_separate_string(mydata, '|', argv, (sizeof(argv) / sizeof(argv[0]))) < 1) {
                        goto error;
                }
 
@@ -352,24 +351,12 @@ static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session,
        return switch_core_session_outgoing_channel(session, var_event, "iax", outbound_profile, new_session, pool, SOF_NONE, cancel_cause);
 }
 
-
-#define WE_DONT_NEED_NO_STINKIN_KEY "true"
-static char *key()
-{
-       return WE_DONT_NEED_NO_STINKIN_KEY;
-}
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_asterisk_load)
 {
        switch_dialplan_interface_t *dp_interface;
        switch_application_interface_t *app_interface;
-       char *mykey = NULL;
        int x = 0;
 
-       if ((mykey = key())) {
-               mykey = NULL;
-       }
-
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
        /* add a dialplan interface */
index 99a65874096debb50c69e89d90b2a616aff677d9..6b1728ebe5b9eaf3e1015905db9ffec15e515d29 100644 (file)
@@ -883,10 +883,9 @@ static void dl_logger(char *file, const char *func, int line, int level, char *f
 {
        va_list ap;
        char *data = NULL;
-       int ret;
 
        va_start(ap, fmt);
-       if ((ret = switch_vasprintf(&data, fmt, ap)) != -1) {
+       if (switch_vasprintf(&data, fmt, ap) != -1) {
                if (!strncasecmp(data, "+xml:", 5)) {
                        switch_xml_t xml;
                        char *form;
@@ -3062,7 +3061,6 @@ SWITCH_STANDARD_API(dl_logout)
 SWITCH_STANDARD_API(dingaling)
 {
        char *argv[10] = { 0 };
-       int argc = 0;
        void *val;
        char *myarg = NULL;
        mdl_profile_t *profile = NULL;
@@ -3077,7 +3075,7 @@ SWITCH_STANDARD_API(dingaling)
                return SWITCH_STATUS_FALSE;
        }
 
-       if ((argc = switch_separate_string(myarg, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) != 1) {
+       if (switch_separate_string(myarg, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) != 1) {
                stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX);
                goto done;
        }
index 0e24faef163b7124c6ebd9116324a2225ad7d240..62eba524d3b43463a1079aac5ce9f107aa1144fb 100644 (file)
@@ -2962,7 +2962,6 @@ static switch_status_t list_calls(char **argv, int argc, switch_stream_handle_t
 static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t *stream)
 {
        switch_core_session_t *session;
-       switch_status_t status = SWITCH_STATUS_SUCCESS;
        char *dest = NULL;
 
        if (zstr(argv[0])) {
@@ -3025,7 +3024,7 @@ static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t
                        switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
                }
                tech_pvt->session = session;
-               if ((status = validate_main_audio_stream()) == SWITCH_STATUS_SUCCESS) {
+               if (validate_main_audio_stream() == SWITCH_STATUS_SUCCESS) {
                        switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
                        switch_channel_mark_answered(channel);
                        switch_channel_set_state(channel, CS_INIT);
index 3df1290047d87337a8f51a86b2bcba580f6e66ca..c6cfc716c7c61949c89de06440c2e684499fd280 100644 (file)
@@ -2056,7 +2056,7 @@ sock_fail:
 
                assert(profile->sock);
 
-               if ((rv = switch_socket_accept(&inbound_socket, profile->sock, listener_pool))) {
+               if (switch_socket_accept(&inbound_socket, profile->sock, listener_pool)) {
                        if (!skinny_globals.running) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n");
                                goto end;
index 0b01e55e66d8d4923b5bd49278a10dd006028015..70331a95e288a3d4d8942c8359525d7dddda1131 100644 (file)
@@ -3007,7 +3007,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime)
                }
 
 
-               if ((rv = switch_socket_accept(&inbound_socket, listen_list.sock, listener_pool))) {
+               if (switch_socket_accept(&inbound_socket, listen_list.sock, listener_pool)) {
                        if (prefs.done) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n");
                                goto end;
index b2f3baf9632380b1c0a04758b1af1b6317bcba47..f1726b677be5c209a683dc1a9a93e11e092daa09 100644 (file)
@@ -53,7 +53,6 @@ static int read_cookie_from_file(char *filename) {
        char cookie[MAXATOMLEN + 1];
        char *end;
        struct stat buf;
-       ssize_t res;
 
        if (!stat(filename, &buf)) {
                if ((buf.st_mode & S_IRWXG) || (buf.st_mode & S_IRWXO)) {
@@ -70,7 +69,7 @@ static int read_cookie_from_file(char *filename) {
                        return 2;
                }
 
-               if ((res = read(fd, cookie, MAXATOMLEN)) < 1) {
+               if (read(fd, cookie, MAXATOMLEN) < 1) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to read cookie file %s : %d.\n", filename, errno);
                }
 
index e8e9f6487dd94adbe09393c7ec7af60a41dd3202..c78fff78e39c043a4a1630f2b40b4763b21a2ccf 100644 (file)
@@ -1589,7 +1589,7 @@ static void *SWITCH_THREAD_FUNC xmpp_listener_thread(switch_thread_t *thread, vo
                }
 
                /* accept the connection */
-               if ((rv = switch_socket_accept(&socket, listener->socket, pool))) {
+               if (switch_socket_accept(&socket, listener->socket, pool)) {
                        if (context->shutdown) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting down xmpp listener\n");
                                goto end;
index 2587313c36efc845c987e56c6a156cb3854cd6c9..b3898ab20064786a6c39ec522def2797c3b2bf25 100644 (file)
@@ -1367,7 +1367,6 @@ SWITCH_STANDARD_API(local_stream_function)
        char *mycmd = NULL, *argv[5] = { 0 };
        char *local_stream_name = NULL;
        int argc = 0;
-       int ok = 0;
 
        if (zstr(cmd)) {
                goto usage;
@@ -1461,7 +1460,7 @@ SWITCH_STANDARD_API(local_stream_function)
                        stream->write_function(stream, "+OK stream: %s", source->name);
                        switch_thread_rwlock_unlock(source->rwlock);
                } else {
-                       if ((ok = launch_streams(local_stream_name))) {
+                       if (launch_streams(local_stream_name)) {
                                stream->write_function(stream, "+OK stream: %s", local_stream_name);
                        }
                }
index e3d5d260747199cb959315a39be4968860fb82b7..412baacf1dca079e0b318ba9cc881307fa056f5d 100644 (file)
@@ -130,7 +130,6 @@ static switch_status_t tone_stream_file_open(switch_file_handle_t *handle, const
        char *tmp;
        int fd = -1;
        char buf[1024] = "";
-       size_t len;
 
        memset(&ts, 0, sizeof(ts));
 
@@ -172,7 +171,7 @@ static switch_status_t tone_stream_file_open(switch_file_handle_t *handle, const
                        return SWITCH_STATUS_FALSE;
                }
 
-               while ((len = switch_fd_read_line(fd, buf, sizeof(buf)))) {
+               while (switch_fd_read_line(fd, buf, sizeof(buf))) {
                        teletone_run(&ts, buf);
                }
                close(fd);
index 63aaf25fc06db362a09e0f7b2de835f78326d66c..b1d19428dcd8d39eb73e2196e0f6bb169f18c172 100644 (file)
@@ -241,7 +241,6 @@ static switch_xml_t lua_fetch(const char *section,
        if (!zstr(globals.xml_handler)) {
                L = lua_init();
                const char *str;
-               int error;
 
                mycmd = strdup(globals.xml_handler);
                switch_assert(mycmd);
@@ -266,7 +265,7 @@ static switch_xml_t lua_fetch(const char *section,
                        mod_lua_conjure_event(L, params, "params", 1);
                }
 
-               if((error = lua_parse_and_execute(L, mycmd, NULL))){
+               if(lua_parse_and_execute(L, mycmd, NULL)){
                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "LUA script parse/execute error!\n");
                    goto end;
                }
@@ -522,7 +521,6 @@ SWITCH_STANDARD_API(lua_api_function)
 {
 
        char *mycmd;
-       int error;
 
        if (zstr(cmd)) {
                stream->write_function(stream, "");
@@ -541,7 +539,7 @@ SWITCH_STANDARD_API(lua_api_function)
                        mod_lua_conjure_event(L, stream->param_event, "env", 1);
                }
 
-               if ((error = lua_parse_and_execute(L, mycmd, session))) {
+               if (lua_parse_and_execute(L, mycmd, session)) {
                        char * http = switch_event_get_header(stream->param_event, "http-uri");
                        if (http && (!strncasecmp(http, "/api/", 5) || !strncasecmp(http, "/webapi/", 8))) {
                                        /* api -> fs api streams the Content-Type e.g. text/html or text/xml               */
index 0893c47c91576ef2f4effb4d5e3c37fb74bef896..77c04fa9fc5dc8e0e8883e0654f4829fd054ca61 100644 (file)
@@ -144,7 +144,7 @@ void Session::check_hangup_hook()
 
 void Session::do_hangup_hook()
 {
-       PyObject *result, *arglist;
+       PyObject *arglist;
        const char *what = hook_state == CS_HANGUP ? "hangup" : "transfer";
 
        if (hh && !mark) {
@@ -167,7 +167,7 @@ void Session::do_hangup_hook()
                                arglist = Py_BuildValue("(Os)", Self, what);
                        }
 
-                       if (!(result = PyEval_CallObject(hangup_func, arglist))) {
+                       if (!PyEval_CallObject(hangup_func, arglist)) {
                                PyErr_Print();
                        }
 
index d0c7c20df5189499af13817f4d69055aba37737c..52a331236102aec1522395ad3e253937e5461b79 100644 (file)
@@ -178,7 +178,6 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi
        PyThreadState *tstate = NULL;
        char *dupargs = NULL;
        char *argv[2] = { 0 };
-       int argc;
        char *script = NULL;
        PyObject *module_o = NULL, *module = NULL, *sp = NULL, *stp = NULL, *eve = NULL;
        PyObject *function = NULL;
@@ -198,7 +197,7 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi
 
        assert(dupargs != NULL);
 
-       if (!(argc = switch_separate_string(dupargs, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+       if (!switch_separate_string(dupargs, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No module name specified!\n");
                goto done;
        }