diff options
author | Richard Mudgett <rmudgett@digium.com> | 2013-07-17 22:30:28 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2013-07-17 22:30:28 +0000 |
commit | 40ce5e0d18520cd7a440cd8849e3e920be68f471 (patch) | |
tree | 5499af489ac45954318119e4294811be3da06dff /main/dial.c | |
parent | da1902cdc060763a712bb1586cfca5ec1e9a2c49 (diff) |
Change ast_hangup() to return void and be NULL safe.
Since ast_hangup() is effectively a channel destructor, it should be a
void function.
* Make the few silly callers checking the return value no longer do so.
Only the CDR and CEL unit tests checked the return value.
* Make all callers take advantage of the NULL safe change and remove the
NULL check before the call.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/dial.c')
-rw-r--r-- | main/dial.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/main/dial.c b/main/dial.c index ab35373c5..e13805ad4 100644 --- a/main/dial.c +++ b/main/dial.c @@ -942,10 +942,8 @@ void ast_dial_hangup(struct ast_dial *dial) AST_LIST_LOCK(&dial->channels); AST_LIST_TRAVERSE(&dial->channels, channel, list) { - if (channel->owner) { - ast_hangup(channel->owner); - channel->owner = NULL; - } + ast_hangup(channel->owner); + channel->owner = NULL; } AST_LIST_UNLOCK(&dial->channels); @@ -976,11 +974,11 @@ int ast_dial_destroy(struct ast_dial *dial) option_types[i].disable(channel->options[i]); channel->options[i] = NULL; } + /* Hang up channel if need be */ - if (channel->owner) { - ast_hangup(channel->owner); - channel->owner = NULL; - } + ast_hangup(channel->owner); + channel->owner = NULL; + /* Free structure */ ast_free(channel->tech); ast_free(channel->device); |