[asterisk-commits] kmoore: trunk r405254 - in /trunk: ./ include/asterisk/ main/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 9 14:34:22 CST 2014


Author: kmoore
Date: Thu Jan  9 14:34:19 2014
New Revision: 405254

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=405254
Log:
astobj2: Correct ao2_iterator opacity violations

This corrects the ao2_iterator opacity violations in
res_pjsip_session.c by adding a global function to get the number of
elements inside the container hidden behind the iterator.

(closes issue ASTERISK-23053)
Review: https://reviewboard.asterisk.org/r/3111/
Reported by: Richard Mudgett
........

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

Modified:
    trunk/   (props changed)
    trunk/include/asterisk/astobj2.h
    trunk/main/astobj2.c
    trunk/res/res_pjsip_session.c

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

Modified: trunk/include/asterisk/astobj2.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/astobj2.h?view=diff&rev=405254&r1=405253&r2=405254
==============================================================================
--- trunk/include/asterisk/astobj2.h (original)
+++ trunk/include/asterisk/astobj2.h Thu Jan  9 14:34:19 2014
@@ -1933,4 +1933,13 @@
 #endif
 void ao2_iterator_cleanup(struct ao2_iterator *iter);
 
+/*!
+ * \brief Get a count of the iterated container objects.
+ *
+ * \param iter the iterator to query
+ *
+ * \retval The number of objects in the iterated container
+ */
+int ao2_iterator_count(struct ao2_iterator *iter);
+
 #endif /* _ASTERISK_ASTOBJ2_H */

Modified: trunk/main/astobj2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/astobj2.c?view=diff&rev=405254&r1=405253&r2=405254
==============================================================================
--- trunk/main/astobj2.c (original)
+++ trunk/main/astobj2.c Thu Jan  9 14:34:19 2014
@@ -1682,6 +1682,11 @@
 	return internal_ao2_iterator_next(iter, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__);
 }
 
+int ao2_iterator_count(struct ao2_iterator *iter)
+{
+	return ao2_container_count(iter->c);
+}
+
 static void container_destruct(void *_c)
 {
 	struct ao2_container *c = _c;

Modified: trunk/res/res_pjsip_session.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip_session.c?view=diff&rev=405254&r1=405253&r2=405254
==============================================================================
--- trunk/res/res_pjsip_session.c (original)
+++ trunk/res/res_pjsip_session.c Thu Jan  9 14:34:19 2014
@@ -471,7 +471,7 @@
 	};
 
 	successful = ao2_callback(session->media, OBJ_MULTIPLE, handle_negotiated_sdp_session_media, &callback_data);
-	if (successful && ao2_container_count(successful->c) == ao2_container_count(session->media)) {
+	if (successful && ao2_iterator_count(successful) == ao2_container_count(session->media)) {
 		/* Nothing experienced a catastrophic failure */
 		ast_queue_frame(session->channel, &ast_null_frame);
 		return 0;
@@ -2026,7 +2026,7 @@
 
 	/* Now let the handlers add streams of various types, pjmedia will automatically reorder the media streams for us */
 	successful = ao2_callback_data(session->media, OBJ_MULTIPLE, add_sdp_streams, local, session);
-	if (!successful || ao2_container_count(successful->c) != ao2_container_count(session->media)) {
+	if (!successful || ao2_iterator_count(successful) != ao2_container_count(session->media)) {
 		/* Something experienced a catastrophic failure */
 		return NULL;
 	}




More information about the asterisk-commits mailing list