]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Multiple revisions 368721,368739,368760,368808
authorJason Parker <jparker@digium.com>
Tue, 12 Jun 2012 16:21:14 +0000 (16:21 +0000)
committerJason Parker <jparker@digium.com>
Tue, 12 Jun 2012 16:21:14 +0000 (16:21 +0000)
........
  r368721 | kmoore | 2012-06-11 09:11:14 -0500 (Mon, 11 Jun 2012) | 8 lines

  Fix compilation in dev-mode

  Backport a compilation fix in md5.c from trunk that only showed up in
  dev-mode under certain compiler versions.
  ........

  Merged revisions 368719 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r368739 | kmoore | 2012-06-11 10:15:07 -0500 (Mon, 11 Jun 2012) | 10 lines

  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)
  ........

  Merged revisions 368738 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r368760 | rmudgett | 2012-06-11 12:08:50 -0500 (Mon, 11 Jun 2012) | 17 lines

  Fix deadlock potential with ast_set_hangupsource() calls.

  Calling ast_set_hangupsource() with the channel lock held can result in a
  deadlock because the function also locks the bridged channel.

  (issue ASTERISK-19537)

  (closes issue AST-891)
  Reported by: Guenther Kelleter
  Tested by: Guenther Kelleter

  (closes issue ASTERISK-19801)
  Reported by: Alec Davis
  ........

  Merged revisions 368759 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r368808 | mmichelson | 2012-06-12 10:37:38 -0500 (Tue, 12 Jun 2012) | 15 lines

  Set the Caller ID "tag" on peers even if remote party information is present.

  On incoming calls, we were setting the cid_tag on the dialog only if there was
  no remote party information (Remote-Party-ID or P-Asserted-Identity) present.
  The Caller ID tag is an invented parameter, though, and should be set no matter
  the circumstance.

  (closes issue ASTERISK-19859)
  Reported by Thomas Arimont
  (closes issue AST-884)
  Reported by Trey Blancher
  ........

  Merged revisions 368807 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 368721,368739,368760,368808 from http://svn.asterisk.org/svn/asterisk/branches/10

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

22 files changed:
apps/app_directory.c
apps/app_queue.c
apps/app_voicemail.c
channels/chan_dahdi.c
channels/chan_iax2.c
channels/chan_sip.c
channels/sig_analog.c
channels/sip/dialplan_functions.c
channels/sip/reqresp_parser.c
channels/sip/sdp_crypto.c
funcs/func_strings.c
include/asterisk/channel.h
main/channel.c
main/loader.c
main/md5.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 8ae95529805a6ca4eae8788a1d70de9512998f9e..d293439b412ea6d240ee7cdd62c40aece67eced1 100644 (file)
@@ -2334,7 +2334,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;
@@ -4907,10 +4907,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 836b576abdc67c64b34f9837fb83eba2b0eb681e..9e2809c945672e068ab61a6a47d232a229207284 100644 (file)
@@ -1629,7 +1629,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 2ce2cf8719d58f9992f0ad8de0fb78e0011bfe4f..9a464248f01412aa1ed6594d9655f451a23b846d 100644 (file)
@@ -8953,13 +8953,18 @@ static struct ast_frame *__dahdi_exception(struct ast_channel *ast)
                f = &p->subs[idx].f;
                return f;
        }
+
        f = dahdi_handle_event(ast);
+       if (!f) {
+               const char *name = ast_strdupa(ast->name);
 
-       /* tell the cdr this zap device hung up */
-       if (f == NULL) {
-               ast_set_hangupsource(ast, ast->name, 0);
+               /* Tell the CDR this DAHDI device hung up */
+               ast_mutex_unlock(&p->lock);
+               ast_channel_unlock(ast);
+               ast_set_hangupsource(ast, name, 0);
+               ast_channel_lock(ast);
+               ast_mutex_lock(&p->lock);
        }
-
        return f;
 }
 
@@ -14459,14 +14464,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 36369e58c2f9b0972ccb2cd30cfc4ffd93674483..8cd425e0c7010aed069f4fc3969809b1331ee140 100644 (file)
@@ -9993,11 +9993,20 @@ static void set_hangup_source_and_cause(int callno, unsigned char causecode)
 {
        iax2_lock_owner(callno);
        if (iaxs[callno] && iaxs[callno]->owner) {
+               struct ast_channel *owner;
+               const char *name;
+
+               owner = iaxs[callno]->owner;
                if (causecode) {
-                       iaxs[callno]->owner->hangupcause = causecode;
+                       owner->hangupcause = causecode;
                }
-               ast_set_hangupsource(iaxs[callno]->owner, iaxs[callno]->owner->name, 0);
-               ast_channel_unlock(iaxs[callno]->owner);
+               name = ast_strdupa(owner->name);
+               ast_channel_ref(owner);
+               ast_channel_unlock(owner);
+               ast_mutex_unlock(&iaxsl[callno]);
+               ast_set_hangupsource(owner, name, 0);
+               ast_channel_unref(owner);
+               ast_mutex_lock(&iaxsl[callno]);
        }
 }
 
index de0b958b1e0b2b433c45b60133258c7c6348e2dd..5288f315a6d335ceffcf181cf702414beb8d5f3d 100644 (file)
@@ -14043,7 +14043,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';
@@ -16651,11 +16651,12 @@ static enum check_auth_result check_peer_ok(struct sip_pvt *p, char *of,
                        }
                        if (!ast_strlen_zero(peer->cid_name))
                                ast_string_field_set(p, cid_name, peer->cid_name);
-                       if (!ast_strlen_zero(peer->cid_tag))
-                               ast_string_field_set(p, cid_tag, peer->cid_tag);
                        if (peer->callingpres)
                                p->callingpres = peer->callingpres;
                }
+               if (!ast_strlen_zero(peer->cid_tag)) {
+                       ast_string_field_set(p, cid_tag, peer->cid_tag);
+               }
                ast_string_field_set(p, fullcontact, peer->fullcontact);
                if (!ast_strlen_zero(peer->context)) {
                        ast_string_field_set(p, context, peer->context);
@@ -20765,6 +20766,41 @@ static void handle_response_publish(struct sip_pvt *p, int resp, const char *res
        }
 }
 
+/*!
+ * \internal
+ * \brief Set hangup source and cause.
+ *
+ * \param p SIP private.
+ * \param cause Hangup cause to queue.  Zero if no cause.
+ *
+ * \pre p and p->owner are locked.
+ *
+ * \return Nothing
+ */
+static void sip_queue_hangup_cause(struct sip_pvt *p, int cause)
+{
+       struct ast_channel *owner = p->owner;
+       const char *name = ast_strdupa(owner->name);
+
+       /* Cannot hold any channel/private locks when calling. */
+       ast_channel_ref(owner);
+       ast_channel_unlock(owner);
+       sip_pvt_unlock(p);
+       ast_set_hangupsource(owner, name, 0);
+       if (cause) {
+               ast_queue_hangup_with_cause(owner, cause);
+       } else {
+               ast_queue_hangup(owner);
+       }
+       ast_channel_unref(owner);
+
+       /* Relock things. */
+       owner = sip_pvt_lock_full(p);
+       if (owner) {
+               ast_channel_unref(owner);
+       }
+}
+
 /*! \brief Handle SIP response to INVITE dialogue */
 static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno)
 {
@@ -21114,16 +21150,14 @@ static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest
                xmitres = transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
                ast_log(LOG_WARNING, "Received response: \"Forbidden\" from '%s'\n", sip_get_header(&p->initreq, "From"));
                if (!req->ignore && p->owner) {
-                       ast_set_hangupsource(p->owner, p->owner->name, 0);
-                       ast_queue_hangup_with_cause(p->owner, hangup_sip2cause(resp));
+                       sip_queue_hangup_cause(p, hangup_sip2cause(resp));
                }
                break;
 
        case 404: /* Not found */
                xmitres = transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
                if (p->owner && !req->ignore) {
-                       ast_set_hangupsource(p->owner, p->owner->name, 0);
-                       ast_queue_hangup_with_cause(p->owner, hangup_sip2cause(resp));
+                       sip_queue_hangup_cause(p, hangup_sip2cause(resp));
                }
                break;
 
@@ -24655,11 +24689,10 @@ static int handle_request_cancel(struct sip_pvt *p, struct sip_request *req)
 
        stop_media_flows(p); /* Immediately stop RTP, VRTP and UDPTL as applicable */
        if (p->owner) {
-               ast_set_hangupsource(p->owner, p->owner->name, 0);
-               ast_queue_hangup(p->owner);
-       }
-       else
+               sip_queue_hangup_cause(p, 0);
+       } else {
                sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
+       }
        if (ast_str_strlen(p->initreq.data) > 0) {
                struct sip_pkt *pkt, *prev_pkt;
                /* If the CANCEL we are receiving is a retransmission, and we already have scheduled
@@ -24813,8 +24846,7 @@ static int handle_request_bye(struct sip_pvt *p, struct sip_request *req)
                                ast_queue_hangup_with_cause(p->owner, AST_CAUSE_PROTOCOL_ERROR);
                }
        } else if (p->owner) {
-               ast_set_hangupsource(p->owner, p->owner->name, 0);
-               ast_queue_hangup(p->owner);
+               sip_queue_hangup_cause(p, 0);
                sip_scheddestroy_final(p, DEFAULT_TRANS_TIMEOUT);
                ast_debug(3, "Received bye, issuing owner hangup\n");
        } else {
index b3e75b18b8243ba7b44d95bbb335f4b0ba207b70..fc027303cb0663a09ce20b1b4eba288f98d5a6f6 100644 (file)
@@ -3623,7 +3623,18 @@ struct ast_frame *analog_exception(struct analog_pvt *p, struct ast_channel *ast
                f = &p->subs[idx].f;
                return f;
        }
+
        f = __analog_handle_event(p, ast);
+       if (!f) {
+               const char *name = ast_strdupa(ast->name);
+
+               /* Tell the CDR this DAHDI device hung up */
+               analog_unlock_private(p);
+               ast_channel_unlock(ast);
+               ast_set_hangupsource(ast, name, 0);
+               ast_channel_lock(ast);
+               analog_lock_private(p);
+       }
        return f;
 }
 
index 0d019c543884c1e925723dd58b65f6344e013151..089792aada8b7af970e4223ac2a8bf03af712985 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 e37d75b793290c8b80cb296fcf4b290c2104042a..d87acda3454a12b289278c2478c7c21ea7e1508b 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 85adf83eb3b2bfcaeb3b757a7f6df408acd8d8b5..7f8835514151c6f177705fcd44970dcd514b1d76 100644 (file)
@@ -52,9 +52,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 e91a65bb3c7a683407b6fa4d85823a2c20fe8bee..2a104f8619a49c5055510c190da275c67531d333 100644 (file)
@@ -584,7 +584,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;
@@ -624,7 +623,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 4e16b5ae7d8f0da77c9cc2fa667db74b5b7ee1cd..1ff14220fb5d2d74c12c7d316e19e1bf16309dc4 100644 (file)
@@ -1474,6 +1474,8 @@ void ast_channel_clear_softhangup(struct ast_channel *chan, int flag);
  * \param source a string describing the source of the hangup for this channel
  * \param force
  *
+ * \note Absolutely _NO_ channel locks should be held before calling this function.
+ *
  * \since 1.8
  *
  * Hangupsource is generally the channel name that caused the bridge to be
index 577e64236a8562ab4626fc7517922360f0b1032b..88a6da89043e68b0739eaa361b93b45978ad3833 100644 (file)
@@ -2773,12 +2773,18 @@ void ast_set_hangupsource(struct ast_channel *chan, const char *source, int forc
                ast_string_field_set(chan, hangupsource, source);
        }
        bridge = ast_bridged_channel(chan);
+       if (bridge) {
+               ast_channel_ref(bridge);
+       }
        ast_channel_unlock(chan);
 
-       if (bridge && (force || ast_strlen_zero(bridge->hangupsource))) {
+       if (bridge) {
                ast_channel_lock(bridge);
-               ast_string_field_set(chan, hangupsource, source);
+               if (force || ast_strlen_zero(bridge->hangupsource)) {
+                       ast_string_field_set(bridge, hangupsource, source);
+               }
                ast_channel_unlock(bridge);
+               ast_channel_unref(bridge);
        }
 }
 
index 6f99c52c03577e1298289ef33c54bc258c4c8dd4..bb4668e1d42cacb0995d7d6a7790a6aef6262811 100644 (file)
@@ -1072,13 +1072,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 cbca747a364c67f7541dcdf6301ad4314ea201d2..d4c7b18848c78b083b770827c3b4956512dce380 100644 (file)
@@ -123,6 +123,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
 {
        unsigned count;
        unsigned char *p;
+       uint32_t *in_buf;
 
        /* Compute number of bytes mod 64 */
        count = (ctx->bits[0] >> 3) & 0x3F;
@@ -151,8 +152,9 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
        byteReverse(ctx->in, 14);
 
        /* Append length in bits and transform */
-       ((uint32_t *) ctx->in)[14] = ctx->bits[0];
-       ((uint32_t *) ctx->in)[15] = ctx->bits[1];
+       in_buf = (uint32_t *) ctx->in;
+       in_buf[14] = ctx->bits[0];
+       in_buf[15] = ctx->bits[1];
 
        MD5Transform(ctx->buf, (uint32_t *) ctx->in);
        byteReverse((unsigned char *) ctx->buf, 4);
index fdcb7745ff94b55ac483c7fef50d53ac35086be8..b12d3795adec35dcf2a6f62aaf3817fddc39fdae 100644 (file)
@@ -1913,7 +1913,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 95420ce7fabdc1a3bb08690dab7c752c5b19ea28..3d3ba16c35c9593f213d63c264403a726ca7f7ca 100644 (file)
@@ -1358,10 +1358,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 a54d58678170f6bc5c11c99b99507ad4d1296cc5..e49bf98b311db5fe3af42c3abec54ae31e05cd0a 100644 (file)
@@ -1481,7 +1481,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))) {
@@ -1551,7 +1551,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 d93cf5b87c77d48a1e4f683c031187bed2c7e4b6..3bec8b6665144ee31709aa96236ca847ad0e949e 100644 (file)
@@ -555,7 +555,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 ebc5e230873421ebd97852b3958459f3e305116f..014929e8733b26b9b7f1d7f4c354083a9afa290f 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 de0c41e087ba3761fc4632bbd30cc90ea5439e13..e6fdab9d09252a824c75450a20e19124bf9514f7 100644 (file)
@@ -276,7 +276,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 */
@@ -286,7 +285,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;
        }