]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Make calls to ast_assert() actually test something, so that the error message
authorTilghman Lesher <tilghman@meg.abyt.es>
Wed, 11 Jun 2008 18:18:16 +0000 (18:18 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Wed, 11 Jun 2008 18:18:16 +0000 (18:18 +0000)
printed is not nonsensical (reported by mvanbaak via #asterisk-bugs).

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

channels/chan_agent.c
main/abstract_jb.c
main/channel.c
main/sched.c

index f216030cf36d0874bffc28ede1170cb7ef08d7ae..0f6fbfbe89e63df281cab20dc16e53aabc14d89b 100644 (file)
@@ -1061,7 +1061,7 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state)
        if (p->chan) {
                if (ast_test_flag(p->chan, AST_FLAG_BLOCKING)) {
                        ast_log( LOG_ERROR, "A blocker exists after agent channel ownership acquired\n" );
-                       ast_assert(0);
+                       ast_assert(ast_test_flag(p->chan, AST_FLAG_BLOCKING) == 0);
                }
        }
        return tmp;
index 25bd8fd0d7d2ab7c86fb30c39e841c4c9188cbb2..1fd4dcdcd6a7adfa7bfadd4f0bda0de1b5a2ffec 100644 (file)
@@ -433,7 +433,7 @@ static void jb_get_and_deliver(struct ast_channel *chan)
                        return;
                default:
                        ast_log(LOG_ERROR, "This should never happen!\n");
-                       ast_assert(0);
+                       ast_assert("JB type unknown" == NULL);
                        break;
                }
                
@@ -487,10 +487,9 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
                        *tmp = '#';
                
                bridged = ast_bridged_channel(chan);
-               if (!bridged) {
-                       /* We should always have bridged chan if a jitterbuffer is in use */
-                       ast_assert(0);
-               }
+               /* We should always have bridged chan if a jitterbuffer is in use */
+               ast_assert(bridged != NULL);
+
                snprintf(name1, sizeof(name1), "%s", bridged->name);
                tmp = strchr(name1, '/');
                if (tmp)
index 5fff0f7d99f3d1722f6b48d0b6cbbaf693aae97f..ad7513cfff4de35b6ac3837f1b44644f042552f1 100644 (file)
@@ -912,7 +912,7 @@ int ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin)
        if (((fin->frametype == AST_FRAME_VOICE) && (qlen > 96)) || (qlen  > 128)) {
                if (fin->frametype != AST_FRAME_VOICE) {
                        ast_log(LOG_WARNING, "Exceptionally long queue length queuing to %s\n", chan->name);
-                       ast_assert(0);
+                       ast_assert(fin->frametype == AST_FRAME_VOICE);
                } else {
                        if (option_debug)
                                ast_log(LOG_DEBUG, "Dropping voice to exceptionally long queue on %s\n", chan->name);
@@ -1476,7 +1476,7 @@ int ast_hangup(struct ast_channel *chan)
                ast_log(LOG_WARNING, "Hard hangup called by thread %ld on %s, while fd "
                                        "is blocked by thread %ld in procedure %s!  Expect a failure\n",
                                        (long)pthread_self(), chan->name, (long)chan->blocker, chan->blockproc);
-               ast_assert(0);
+               ast_assert(ast_test_flag(chan, AST_FLAG_BLOCKING) == 0);
        }
        if (!ast_test_flag(chan, AST_FLAG_ZOMBIE)) {
                if (option_debug)
index 935e85398af93e3e27425d89bc70b1a36632d6d3..f020aa19661b7acdeafd882485691d7a248e90ec 100644 (file)
@@ -282,7 +282,7 @@ int ast_sched_del(struct sched_context *con, int id)
        if (!s) {
                if (option_debug)
                        ast_log(LOG_DEBUG, "Attempted to delete nonexistent schedule entry %d!\n", id);
-               ast_assert(0);
+               ast_assert(s != NULL);
                return -1;
        }