[asterisk-commits] russell: branch russell/messaging r299195 - in /team/russell/messaging: chann...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 20 20:54:14 UTC 2010


Author: russell
Date: Mon Dec 20 14:54:10 2010
New Revision: 299195

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=299195
Log:
Add ast_msg_destroy() instead of using ao2_ref() directly.

Modified:
    team/russell/messaging/channels/chan_sip.c
    team/russell/messaging/include/asterisk/message.h
    team/russell/messaging/main/message.c
    team/russell/messaging/res/res_jabber.c

Modified: team/russell/messaging/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/messaging/channels/chan_sip.c?view=diff&rev=299195&r1=299194&r2=299195
==============================================================================
--- team/russell/messaging/channels/chan_sip.c (original)
+++ team/russell/messaging/channels/chan_sip.c Mon Dec 20 14:54:10 2010
@@ -15523,7 +15523,7 @@
 	res |= ast_msg_set_context(msg, "%s", p->context);
 
 	if (res) {
-		ao2_ref(msg, -1);
+		ast_msg_destroy(msg);
 	} else {
 		ast_msg_queue(msg);
 	}

Modified: team/russell/messaging/include/asterisk/message.h
URL: http://svnview.digium.com/svn/asterisk/team/russell/messaging/include/asterisk/message.h?view=diff&rev=299195&r1=299194&r2=299195
==============================================================================
--- team/russell/messaging/include/asterisk/message.h (original)
+++ team/russell/messaging/include/asterisk/message.h Mon Dec 20 14:54:10 2010
@@ -57,6 +57,16 @@
 
 struct ast_msg *ast_msg_alloc(void);
 
+/*!
+ * \brief Destroy an ast_msg
+ *
+ * This should only be called on a message if it was not
+ * passed on to ast_msg_queue().
+ *
+ * \return NULL, always.
+ */
+struct ast_msg *ast_msg_destroy(struct ast_msg *msg);
+
 int __attribute__((format(printf, 2, 3)))
 		ast_msg_set_to(struct ast_msg *msg,const char *fmt, ...);
 

Modified: team/russell/messaging/main/message.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/messaging/main/message.c?view=diff&rev=299195&r1=299194&r2=299195
==============================================================================
--- team/russell/messaging/main/message.c (original)
+++ team/russell/messaging/main/message.c Mon Dec 20 14:54:10 2010
@@ -224,6 +224,13 @@
 	ast_str_set(&msg->context, 0, "default");
 
 	return msg;
+}
+
+struct ast_msg *ast_msg_destroy(struct ast_msg *msg)
+{
+	ao2_ref(msg, -1);
+
+	return NULL;
 }
 
 int ast_msg_set_to(struct ast_msg *msg, const char *fmt, ...)

Modified: team/russell/messaging/res/res_jabber.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/messaging/res/res_jabber.c?view=diff&rev=299195&r1=299194&r2=299195
==============================================================================
--- team/russell/messaging/res/res_jabber.c (original)
+++ team/russell/messaging/res/res_jabber.c Mon Dec 20 14:54:10 2010
@@ -2304,7 +2304,7 @@
 		res |= ast_msg_set_context(msg, "%s", client->context);
 
 		if (res) {
-			ao2_ref(msg, -1);
+			ast_msg_destroy(msg);
 		} else {
 			ast_msg_queue(msg);
 		}




More information about the asterisk-commits mailing list