]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix coverity UNUSED_VALUE findings in core support level files
authorKinsey Moore <kmoore@digium.com>
Mon, 11 Jun 2012 15:13:22 +0000 (15:13 +0000)
committerKinsey Moore <kmoore@digium.com>
Mon, 11 Jun 2012 15:13:22 +0000 (15:13 +0000)
Most of these were just saving returned values without using them and
in some cases the variable being saved to could be removed as well.

(issue ASTERISK-19672)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@368738 65c4cc65-6c06-0410-ace0-fbb531ad65f3

17 files changed:
apps/app_directory.c
apps/app_queue.c
apps/app_voicemail.c
channels/chan_dahdi.c
channels/chan_sip.c
channels/sip/dialplan_functions.c
channels/sip/reqresp_parser.c
channels/sip/sdp_crypto.c
funcs/func_strings.c
main/loader.c
main/say.c
main/udptl.c
pbx/pbx_config.c
res/res_config_odbc.c
res/res_fax.c
res/res_odbc.c
res/res_speech.c

index dccae948b97ef7d80f243476376484ad017210e9..ac2acedece237a7e42db7183ab36ba85b497506c 100644 (file)
@@ -475,7 +475,8 @@ static struct ast_config *realtime_directory(char *context)
                const char *context = ast_variable_retrieve(rtdata, mailbox, "context");
 
                fullname = ast_variable_retrieve(rtdata, mailbox, "fullname");
-               if (ast_true((hidefromdir = ast_variable_retrieve(rtdata, mailbox, "hidefromdir")))) {
+               hidefromdir = ast_variable_retrieve(rtdata, mailbox, "hidefromdir");
+               if (ast_true(hidefromdir)) {
                        /* Skip hidden */
                        continue;
                }
index 62577aca71a9f0335c6e1d0225e689ef7ef5798e..34703f147870c18bb2ca92ff741d2158686bd036 100644 (file)
@@ -2281,7 +2281,7 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
        memset(tmpbuf, 0, sizeof(tmpbuf));
        for (v = queue_vars; v; v = v->next) {
                /* Convert to dashes `-' from underscores `_' as the latter are more SQL friendly. */
-               if ((tmp = strchr(v->name, '_'))) {
+               if (strchr(v->name, '_')) {
                        ast_copy_string(tmpbuf, v->name, sizeof(tmpbuf));
                        tmp_name = tmpbuf;
                        tmp = tmpbuf;
@@ -4814,10 +4814,10 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                /* Begin Monitoring */
                if (qe->parent->monfmt && *qe->parent->monfmt) {
                        if (!qe->parent->montype) {
-                               const char *monexec, *monargs;
+                               const char *monexec;
                                ast_debug(1, "Starting Monitor as requested.\n");
                                ast_channel_lock(qe->chan);
-                               if ((monexec = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC")) || (monargs = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC_ARGS"))) {
+                               if ((monexec = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC")) || pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC_ARGS")) {
                                        which = qe->chan;
                                        monexec = monexec ? ast_strdupa(monexec) : NULL;
                                }
index 2a633264edfbc915a7325fe1e6565d88b5db6a9e..96adc2fa608308a8a89e1295742e32c05d8d0b07 100644 (file)
@@ -1581,7 +1581,7 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
                        for (category = ast_category_browse(cfg, NULL); category; category = ast_category_browse(cfg, category)) {
                                ast_debug(4, "users.conf: %s\n", category);
                                if (!strcasecmp(category, vmu->mailbox)) {
-                                       if (!(tmp = ast_variable_retrieve(cfg, category, "vmsecret"))) {
+                                       if (!ast_variable_retrieve(cfg, category, "vmsecret")) {
                                                ast_debug(3, "looks like we need to make vmsecret!\n");
                                                var = ast_variable_new("vmsecret", newpassword, "");
                                        } else {
index 45ae9cdf91ad94e30b43af63b8f1ebf566865d85..e31347dd2e19f88c2d86b833a437bd31cef446d2 100644 (file)
@@ -14351,14 +14351,13 @@ static char *handle_pri_service_generic(struct ast_cli_entry *e, int cmd, struct
        int trunkgroup;
        int x, y, fd = a->fd;
        int interfaceid = 0;
-       char *c;
        char db_chan_name[20], db_answer[5];
        struct dahdi_pvt *tmp;
        struct dahdi_pri *pri;
 
        if (a->argc < 5 || a->argc > 6)
                return CLI_SHOWUSAGE;
-       if ((c = strchr(a->argv[4], ':'))) {
+       if (strchr(a->argv[4], ':')) {
                if (sscanf(a->argv[4], "%30d:%30d", &trunkgroup, &channel) != 2)
                        return CLI_SHOWUSAGE;
                if ((trunkgroup < 1) || (channel < 1))
index 31118ceb734e56a5bbb945870a68086db1eb7568..e49deb1c23498224b7f819c28807298580bd05c7 100644 (file)
@@ -13549,7 +13549,7 @@ static int transmit_refer(struct sip_pvt *p, const char *dest)
                ast_log(LOG_NOTICE, "From address missing 'sip(s):', assuming sip:\n");
        }
        /* Get just the username part */
-       if ((c = strchr(dest, '@'))) {
+       if (strchr(dest, '@')) {
                c = NULL;
        } else if ((c = strchr(of, '@'))) {
                *c++ = '\0';
index 7454d699bb9b7dbe1f5abbcc9dbe05f7eb6b380d..7138de4bf4961332d47262cab1e3fcb7b7fd6691 100644 (file)
@@ -153,9 +153,9 @@ int sip_acf_channel_read(struct ast_channel *chan, const char *funcname, char *p
                }
 
                if (ast_strlen_zero(args.field) || !strcasecmp(args.field, "all")) {
-                       char quality_buf[AST_MAX_USER_FIELD], *quality;
+                       char quality_buf[AST_MAX_USER_FIELD];
 
-                       if (!(quality = ast_rtp_instance_get_quality(rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf)))) {
+                       if (!ast_rtp_instance_get_quality(rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf))) {
                                return -1;
                        }
 
index 43e670a88645d447af52ec41f6eb446082926f42..6cd3d6a9e3143ac475c2c754a552bc2b84736fde 100644 (file)
@@ -1079,7 +1079,7 @@ AST_TEST_DEFINE(get_in_brackets_test)
        }
 
        /* Test 6, NULL input  */
-       if ((uri = get_in_brackets(NULL))) {
+       if (get_in_brackets(NULL)) {
                ast_test_status_update(test, "Test 6, NULL input failed.\n");
                res = AST_TEST_FAIL;
        }
index d78515ad16d37727b7c156c1744815bea2bbaf19..fa0419e01f66faab35e21ac78c63da4df356658c 100644 (file)
@@ -51,9 +51,7 @@ static int set_crypto_policy(struct ast_srtp_policy *policy, int suite_val, cons
 
 static struct sdp_crypto *sdp_crypto_alloc(void)
 {
-       struct sdp_crypto *crypto;
-
-       return crypto = ast_calloc(1, sizeof(*crypto));
+       return ast_calloc(1, sizeof(struct sdp_crypto));
 }
 
 void sdp_crypto_destroy(struct sdp_crypto *crypto)
index 7a8223ad773556d73c4e78941ad439b9c6137241..2157b8cc29e7e72a059c907531bf4020be65e44a 100644 (file)
@@ -566,7 +566,6 @@ static int listfilter(struct ast_channel *chan, const char *cmd, char *parse, ch
                AST_APP_ARG(delimiter);
                AST_APP_ARG(fieldvalue);
        );
-       const char *ptr;
        struct ast_str *orig_list = ast_str_thread_get(&tmp_buf, 16);
        const char *begin, *cur, *next;
        int dlen, flen, first = 1;
@@ -606,7 +605,7 @@ static int listfilter(struct ast_channel *chan, const char *cmd, char *parse, ch
        }
 
        /* If the string isn't there, just copy out the string and be done with it. */
-       if (!(ptr = strstr(ast_str_buffer(orig_list), args.fieldvalue))) {
+       if (!strstr(ast_str_buffer(orig_list), args.fieldvalue)) {
                if (buf) {
                        ast_copy_string(buf, ast_str_buffer(orig_list), len);
                } else {
index 06f59cb6c898f8e93449c04a8f8576314e6c3669..ba66fed6f60f6f2f27094c9aaeb5d2746cded23e 100644 (file)
@@ -1066,13 +1066,13 @@ int load_modules(unsigned int preload_only)
                        if (mod->flags.running)
                                continue;
 
-                       order = add_to_load_order(mod->resource, &load_order, 0);
+                       add_to_load_order(mod->resource, &load_order, 0);
                }
 
 #ifdef LOADABLE_MODULES
                /* if we are allowed to load dynamic modules, scan the directory for
                   for all available modules and add them as well */
-               if ((dir  = opendir(ast_config_AST_MODULE_DIR))) {
+               if ((dir = opendir(ast_config_AST_MODULE_DIR))) {
                        while ((dirent = readdir(dir))) {
                                int ld = strlen(dirent->d_name);
 
index e1580a3c1198cff65c25a1c8ec87f04976ec6b35..77047223af4658b7a64a35a81737cdf51a4cd20e 100644 (file)
@@ -1907,7 +1907,7 @@ static void powiedz(struct ast_channel *chan, const char *language, int audiofd,
                        char *b = buf;
                        b = pl_append(b, odm->dziesiatki[m100 / 10]);  
                        b = pl_append(b, odm->separator_dziesiatek);  
-                       b = pl_append(b, odm->cyfry2[m100 % 10]); 
+                       pl_append(b, odm->cyfry2[m100 % 10]); 
                        pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, buf);
                }
        } 
index f2cc49422af81928332a712a45f448557b32964e..8cdf9147d89f4d4d71c26a5115cd06df626e4032 100644 (file)
@@ -1355,10 +1355,10 @@ static void __ast_udptl_reload(int reload)
                                ast_log(LOG_WARNING, "Disabling UDPTL checksums is not supported on this operating system!\n");
 #endif
                }
-               if ((s = ast_variable_retrieve(cfg, "general", "T38FaxUdpEC"))) {
+               if (ast_variable_retrieve(cfg, "general", "T38FaxUdpEC")) {
                        ast_log(LOG_WARNING, "T38FaxUdpEC in udptl.conf is no longer supported; use the t38pt_udptl configuration option in sip.conf instead.\n");
                }
-               if ((s = ast_variable_retrieve(cfg, "general", "T38FaxMaxDatagram"))) {
+               if (ast_variable_retrieve(cfg, "general", "T38FaxMaxDatagram")) {
                        ast_log(LOG_WARNING, "T38FaxMaxDatagram in udptl.conf is no longer supported; value is now supplied by T.38 applications.\n");
                }
                if ((s = ast_variable_retrieve(cfg, "general", "UDPTLFECEntries"))) {
index 76d14ac47cf1e38b5e368420150ae294e0fd993f..305fe8e3b936b42e4bcc2014eed906983ac66b3d 100644 (file)
@@ -1467,7 +1467,7 @@ static int pbx_load_config(const char *config_file)
                                }
                        } else if (!strcasecmp(v->name, "exten")) {
                                int ipri;
-                               char *plus, *firstp;
+                               char *plus;
                                char *pri, *appl, *data, *cidmatch;
 
                                if (!(stringp = tc = ast_strdup(v->value))) {
@@ -1537,7 +1537,7 @@ process_extension:
                                }
                                appl = S_OR(stringp, "");
                                /* Find the first occurrence of '(' */
-                               if (!(firstp = strchr(appl, '('))) {
+                               if (!strchr(appl, '(')) {
                                        /* No arguments */
                                        data = "";
                                } else {
index 46922835fdc8b34fbfb310a803c193fd43b841ce..66e15a02be17a30568c6e15dedb45b67615f7e76 100644 (file)
@@ -518,7 +518,7 @@ static int update_odbc(const char *database, const char *table, const char *keyf
        }
        va_arg(aq, const char *);
 
-       if (tableptr && !(column = ast_odbc_find_column(tableptr, newparam))) {
+       if (tableptr && !ast_odbc_find_column(tableptr, newparam)) {
                ast_log(LOG_WARNING, "Key field '%s' does not exist in table '%s@%s'.  Update will fail\n", newparam, table, database);
        }
 
@@ -587,7 +587,6 @@ static SQLHSTMT update2_prepare(struct odbc_obj *obj, void *data)
        SQLHSTMT stmt;
        va_list ap;
        struct odbc_cache_tables *tableptr = ast_odbc_find_table(ups->database, ups->table);
-       struct odbc_cache_columns *column;
 
        if (!sql) {
                if (tableptr) {
@@ -619,7 +618,7 @@ static SQLHSTMT update2_prepare(struct odbc_obj *obj, void *data)
 
        while ((newparam = va_arg(ap, const char *))) {
                newval = va_arg(ap, const char *);
-               if ((column = ast_odbc_find_column(tableptr, newparam))) {
+               if (ast_odbc_find_column(tableptr, newparam)) {
                        ast_str_append(&sql, 0, "%s%s=? ", first ? "" : ", ", newparam);
                        SQLBindParameter(stmt, x++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(newval), 0, (void *)newval, 0, NULL);
                        first = 0;
@@ -637,7 +636,7 @@ static SQLHSTMT update2_prepare(struct odbc_obj *obj, void *data)
 
        while ((newparam = va_arg(ap, const char *))) {
                newval = va_arg(ap, const char *);
-               if (!(column = ast_odbc_find_column(tableptr, newparam))) {
+               if (!ast_odbc_find_column(tableptr, newparam)) {
                        va_end(ap);
                        ast_log(LOG_ERROR, "One or more of the criteria columns '%s' on '%s@%s' for this update does not exist!\n", newparam, ups->table, ups->database);
                        ast_odbc_release_table(tableptr);
index fbbe650ea5d28bb57dd091c46033fd2e0df500f4..93d92d222351acf1bf6b96fe30048df2e8feace5 100644 (file)
@@ -462,7 +462,7 @@ static int update_modem_bits(enum ast_fax_modems *bits, const char *value)
        char *m[5], *tok, *v = (char *)value;
        int i = 0, j;
 
-       if (!(tok = strchr(v, ','))) {
+       if (!strchr(v, ',')) {
                m[i++] = v;
                m[i] = NULL;
        } else {
index 77874202677d1304f57ed95d667af273007e01b8..c51eaac43a6ba637f2fc8e95f3c2ac22cdafb5f1 100644 (file)
@@ -1632,7 +1632,7 @@ static int acf_transaction_write(struct ast_channel *chan, const char *cmd, char
                                pbx_builtin_setvar_helper(chan, "ODBC_RESULT", "INVALID_DB");
                                return -1;
                        }
-                       if (!(tx = find_transaction(chan, obj, value, 0))) {
+                       if (!find_transaction(chan, obj, value, 0)) {
                                pbx_builtin_setvar_helper(chan, "ODBC_RESULT", "FAILED_TO_CREATE");
                                return -1;
                        }
index 9b043190be1268eb2d32110ccfba8eabc6a7b020..ad8bf81cea69030e91257c075eca27b0cde143b9 100644 (file)
@@ -271,7 +271,6 @@ int ast_speech_change_results_type(struct ast_speech *speech, enum ast_speech_re
 /*! \brief Register a speech recognition engine */
 int ast_speech_register(struct ast_speech_engine *engine)
 {
-       struct ast_speech_engine *existing_engine = NULL;
        int res = 0;
 
        /* Confirm the engine meets the minimum API requirements */
@@ -281,7 +280,7 @@ int ast_speech_register(struct ast_speech_engine *engine)
        }
 
        /* If an engine is already loaded with this name, error out */
-       if ((existing_engine = find_engine(engine->name))) {
+       if (find_engine(engine->name)) {
                ast_log(LOG_WARNING, "Speech recognition engine '%s' already exists.\n", engine->name);
                return -1;
        }