[asterisk-commits] rmudgett: trunk r411637 - in /trunk: ./ main/stasis_channels.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 1 17:34:34 CDT 2014


Author: rmudgett
Date: Tue Apr  1 17:34:30 2014
New Revision: 411637

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=411637
Log:
stasis_channels.c: Eliminate another overuse of RAII_VAR().
........

Merged revisions 411636 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/main/stasis_channels.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/main/stasis_channels.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/stasis_channels.c?view=diff&rev=411637&r1=411636&r2=411637
==============================================================================
--- trunk/main/stasis_channels.c (original)
+++ trunk/main/stasis_channels.c Tue Apr  1 17:34:30 2014
@@ -366,14 +366,9 @@
 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 @@
 		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;
 }
 




More information about the asterisk-commits mailing list