Merged revisions 121861 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r121861 | tilghman | 2008-06-11 13:18:16 -0500 (Wed, 11 Jun 2008) | 3 lines

Make calls to ast_assert() actually test something, so that the error message
printed is not nonsensical (reported by mvanbaak via #asterisk-bugs).

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121867 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2008-06-11 18:19:24 +00:00
parent 4639347531
commit 467c6f5f90
4 changed files with 8 additions and 9 deletions

View File

@@ -1018,7 +1018,7 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state)
if (p->chan) { if (p->chan) {
if (ast_test_flag(p->chan, AST_FLAG_BLOCKING)) { if (ast_test_flag(p->chan, AST_FLAG_BLOCKING)) {
ast_log( LOG_ERROR, "A blocker exists after agent channel ownership acquired\n" ); 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; return tmp;

View File

@@ -430,7 +430,7 @@ static void jb_get_and_deliver(struct ast_channel *chan)
return; return;
default: default:
ast_log(LOG_ERROR, "This should never happen!\n"); ast_log(LOG_ERROR, "This should never happen!\n");
ast_assert(0); ast_assert("JB type unknown" == NULL);
break; break;
} }
@@ -484,10 +484,9 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
*tmp = '#'; *tmp = '#';
bridged = ast_bridged_channel(chan); bridged = ast_bridged_channel(chan);
if (!bridged) {
/* We should always have bridged chan if a jitterbuffer is in use */ /* We should always have bridged chan if a jitterbuffer is in use */
ast_assert(0); ast_assert(bridged != NULL);
}
snprintf(name1, sizeof(name1), "%s", bridged->name); snprintf(name1, sizeof(name1), "%s", bridged->name);
tmp = strchr(name1, '/'); tmp = strchr(name1, '/');
if (tmp) if (tmp)

View File

@@ -983,7 +983,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) && (qlen > 96)) || (qlen > 128)) {
if (fin->frametype != AST_FRAME_VOICE) { if (fin->frametype != AST_FRAME_VOICE) {
ast_log(LOG_WARNING, "Exceptionally long queue length queuing to %s\n", chan->name); 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 { } else {
ast_debug(1, "Dropping voice to exceptionally long queue on %s\n", chan->name); ast_debug(1, "Dropping voice to exceptionally long queue on %s\n", chan->name);
ast_frfree(f); ast_frfree(f);
@@ -1641,7 +1641,7 @@ int ast_hangup(struct ast_channel *chan)
ast_log(LOG_WARNING, "Hard hangup called by thread %ld on %s, while fd " 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", "is blocked by thread %ld in procedure %s! Expect a failure\n",
(long)pthread_self(), chan->name, (long)chan->blocker, chan->blockproc); (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 (!ast_test_flag(chan, AST_FLAG_ZOMBIE)) {
ast_debug(1, "Hanging up channel '%s'\n", chan->name); ast_debug(1, "Hanging up channel '%s'\n", chan->name);

View File

@@ -373,7 +373,7 @@ int ast_sched_del(struct sched_context *con, int id)
if (!s) { if (!s) {
ast_debug(1, "Attempted to delete nonexistent schedule entry %d!\n", id); ast_debug(1, "Attempted to delete nonexistent schedule entry %d!\n", id);
ast_assert(0); ast_assert(s != NULL);
return -1; return -1;
} }