[asterisk-commits] kmoore: branch 1.8 r368738 - in /branches/1.8: apps/ channels/ channels/sip/ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 11 10:13:31 CDT 2012


Author: kmoore
Date: Mon Jun 11 10:13:22 2012
New Revision: 368738

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=368738
Log:
Fix coverity UNUSED_VALUE findings in core support level files

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)

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

Modified: branches/1.8/apps/app_directory.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/apps/app_directory.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/apps/app_directory.c (original)
+++ branches/1.8/apps/app_directory.c Mon Jun 11 10:13:22 2012
@@ -475,7 +475,8 @@
 		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;
 		}

Modified: branches/1.8/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/apps/app_queue.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/apps/app_queue.c (original)
+++ branches/1.8/apps/app_queue.c Mon Jun 11 10:13:22 2012
@@ -2281,7 +2281,7 @@
 	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 @@
 		/* 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;
 				}

Modified: branches/1.8/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/apps/app_voicemail.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/apps/app_voicemail.c (original)
+++ branches/1.8/apps/app_voicemail.c Mon Jun 11 10:13:22 2012
@@ -1581,7 +1581,7 @@
 			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 {

Modified: branches/1.8/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_dahdi.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/channels/chan_dahdi.c (original)
+++ branches/1.8/channels/chan_dahdi.c Mon Jun 11 10:13:22 2012
@@ -14351,14 +14351,13 @@
 	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))

Modified: branches/1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_sip.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Mon Jun 11 10:13:22 2012
@@ -13549,7 +13549,7 @@
 		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';

Modified: branches/1.8/channels/sip/dialplan_functions.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/sip/dialplan_functions.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/channels/sip/dialplan_functions.c (original)
+++ branches/1.8/channels/sip/dialplan_functions.c Mon Jun 11 10:13:22 2012
@@ -153,9 +153,9 @@
 		}
 
 		if (ast_strlen_zero(args.field) || !strcasecmp(args.field, "all")) {
-			char quality_buf[AST_MAX_USER_FIELD], *quality;
-
-			if (!(quality = ast_rtp_instance_get_quality(rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf)))) {
+			char quality_buf[AST_MAX_USER_FIELD];
+
+			if (!ast_rtp_instance_get_quality(rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf))) {
 				return -1;
 			}
 

Modified: branches/1.8/channels/sip/reqresp_parser.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/sip/reqresp_parser.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/channels/sip/reqresp_parser.c (original)
+++ branches/1.8/channels/sip/reqresp_parser.c Mon Jun 11 10:13:22 2012
@@ -1079,7 +1079,7 @@
 	}
 
 	/* 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;
 	}

Modified: branches/1.8/channels/sip/sdp_crypto.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/sip/sdp_crypto.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/channels/sip/sdp_crypto.c (original)
+++ branches/1.8/channels/sip/sdp_crypto.c Mon Jun 11 10:13:22 2012
@@ -51,9 +51,7 @@
 
 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)

Modified: branches/1.8/funcs/func_strings.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/funcs/func_strings.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/funcs/func_strings.c (original)
+++ branches/1.8/funcs/func_strings.c Mon Jun 11 10:13:22 2012
@@ -566,7 +566,6 @@
 		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 @@
 	}
 
 	/* 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 {

Modified: branches/1.8/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/loader.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/main/loader.c (original)
+++ branches/1.8/main/loader.c Mon Jun 11 10:13:22 2012
@@ -1066,13 +1066,13 @@
 			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);
 

Modified: branches/1.8/main/say.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/say.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/main/say.c (original)
+++ branches/1.8/main/say.c Mon Jun 11 10:13:22 2012
@@ -1907,7 +1907,7 @@
 			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);
 		}
 	} 

Modified: branches/1.8/main/udptl.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/udptl.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/main/udptl.c (original)
+++ branches/1.8/main/udptl.c Mon Jun 11 10:13:22 2012
@@ -1355,10 +1355,10 @@
 				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"))) {

Modified: branches/1.8/pbx/pbx_config.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/pbx/pbx_config.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/pbx/pbx_config.c (original)
+++ branches/1.8/pbx/pbx_config.c Mon Jun 11 10:13:22 2012
@@ -1467,7 +1467,7 @@
 				}
 			} 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 @@
 				}
 				appl = S_OR(stringp, "");
 				/* Find the first occurrence of '(' */
-				if (!(firstp = strchr(appl, '('))) {
+				if (!strchr(appl, '(')) {
 					/* No arguments */
 					data = "";
 				} else {

Modified: branches/1.8/res/res_config_odbc.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/res/res_config_odbc.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/res/res_config_odbc.c (original)
+++ branches/1.8/res/res_config_odbc.c Mon Jun 11 10:13:22 2012
@@ -518,7 +518,7 @@
 	}
 	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 @@
 	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 @@
 
 	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 @@
 
 	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);

Modified: branches/1.8/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/res/res_fax.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/res/res_fax.c (original)
+++ branches/1.8/res/res_fax.c Mon Jun 11 10:13:22 2012
@@ -462,7 +462,7 @@
 	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 {

Modified: branches/1.8/res/res_odbc.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/res/res_odbc.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/res/res_odbc.c (original)
+++ branches/1.8/res/res_odbc.c Mon Jun 11 10:13:22 2012
@@ -1632,7 +1632,7 @@
 				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;
 			}

Modified: branches/1.8/res/res_speech.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/res/res_speech.c?view=diff&rev=368738&r1=368737&r2=368738
==============================================================================
--- branches/1.8/res/res_speech.c (original)
+++ branches/1.8/res/res_speech.c Mon Jun 11 10:13:22 2012
@@ -271,7 +271,6 @@
 /*! \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 @@
 	}
 
 	/* 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;
 	}




More information about the asterisk-commits mailing list