mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-16 01:36:48 +00:00
stasis_channels.c: Eliminate another overuse of RAII_VAR().
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@411636 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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,
|
static struct stasis_message *create_channel_blob_message(struct ast_channel_snapshot *snapshot,
|
||||||
struct stasis_message_type *type,
|
struct stasis_message_type *type,
|
||||||
struct ast_json *blob)
|
struct ast_json *blob)
|
||||||
|
|
||||||
{
|
{
|
||||||
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
|
struct stasis_message *msg;
|
||||||
RAII_VAR(struct ast_channel_blob *, obj, NULL, ao2_cleanup);
|
struct ast_channel_blob *obj;
|
||||||
|
|
||||||
if (blob == NULL) {
|
|
||||||
blob = ast_json_null();
|
|
||||||
}
|
|
||||||
|
|
||||||
obj = ao2_alloc(sizeof(*obj), channel_blob_dtor);
|
obj = ao2_alloc(sizeof(*obj), channel_blob_dtor);
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
@@ -384,14 +379,13 @@ static struct stasis_message *create_channel_blob_message(struct ast_channel_sna
|
|||||||
obj->snapshot = snapshot;
|
obj->snapshot = snapshot;
|
||||||
ao2_ref(obj->snapshot, +1);
|
ao2_ref(obj->snapshot, +1);
|
||||||
}
|
}
|
||||||
|
if (!blob) {
|
||||||
|
blob = ast_json_null();
|
||||||
|
}
|
||||||
obj->blob = ast_json_ref(blob);
|
obj->blob = ast_json_ref(blob);
|
||||||
|
|
||||||
msg = stasis_message_create(type, obj);
|
msg = stasis_message_create(type, obj);
|
||||||
if (!msg) {
|
ao2_cleanup(obj);
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ao2_ref(msg, +1);
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user