diff options
author | Richard Mudgett <rmudgett@digium.com> | 2014-04-01 22:34:30 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2014-04-01 22:34:30 +0000 |
commit | 7542361f4a3ae7d91fe7f979465033e1de6ed390 (patch) | |
tree | ecc479dc57511c80055ebce95ee340b27cfdb299 | |
parent | c7b8633c26a4be0ce51960ac61df7d601f104e1f (diff) |
stasis_channels.c: Eliminate another overuse of RAII_VAR().
........
Merged revisions 411636 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | main/stasis_channels.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/main/stasis_channels.c b/main/stasis_channels.c index fe65c1766..45ec53d7f 100644 --- a/main/stasis_channels.c +++ b/main/stasis_channels.c @@ -366,14 +366,9 @@ void ast_channel_publish_dial(struct ast_channel *caller, struct ast_channel *pe static struct stasis_message *create_channel_blob_message(struct ast_channel_snapshot *snapshot, struct stasis_message_type *type, struct ast_json *blob) - { - RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup); - RAII_VAR(struct ast_channel_blob *, obj, NULL, ao2_cleanup); - - if (blob == NULL) { - blob = ast_json_null(); - } + struct stasis_message *msg; + struct ast_channel_blob *obj; obj = ao2_alloc(sizeof(*obj), channel_blob_dtor); if (!obj) { @@ -384,14 +379,13 @@ static struct stasis_message *create_channel_blob_message(struct ast_channel_sna obj->snapshot = snapshot; ao2_ref(obj->snapshot, +1); } + if (!blob) { + blob = ast_json_null(); + } obj->blob = ast_json_ref(blob); msg = stasis_message_create(type, obj); - if (!msg) { - return NULL; - } - - ao2_ref(msg, +1); + ao2_cleanup(obj); return msg; } |