[svn-commits] rmudgett: branch group/media_formats-reviewed-trunk r418786 - /team/group/med...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jul 16 17:31:24 CDT 2014


Author: rmudgett
Date: Wed Jul 16 17:31:17 2014
New Revision: 418786

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=418786
Log:
format.c: No need for lock on immutable format and format_interface objects.

Don't give a lock to the ast_format and format_interface objects because
they are immutable.

Review: https://reviewboard.asterisk.org/r/3814/

Modified:
    team/group/media_formats-reviewed-trunk/main/format.c

Modified: team/group/media_formats-reviewed-trunk/main/format.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/main/format.c?view=diff&rev=418786&r1=418785&r2=418786
==============================================================================
--- team/group/media_formats-reviewed-trunk/main/format.c (original)
+++ team/group/media_formats-reviewed-trunk/main/format.c Wed Jul 16 17:31:17 2014
@@ -148,13 +148,14 @@
 		return -1;
 	}
 
-	format_interface = ao2_alloc(sizeof(*format_interface) + strlen(codec) + 1, NULL);/* BUGBUG this doesn't need a lock. */
+	format_interface = ao2_alloc_options(sizeof(*format_interface) + strlen(codec) + 1,
+		NULL, AO2_ALLOC_OPT_LOCK_NOLOCK);
 	if (!format_interface) {
 		return -1;
 	}
-
 	format_interface->interface = interface;
-	strcpy(format_interface->codec, codec);
+	strcpy(format_interface->codec, codec); /* Safe */
+
 	ao2_link_flags(interfaces, format_interface, OBJ_NOLOCK);
 	ao2_ref(format_interface, -1);
 
@@ -190,7 +191,8 @@
 	struct ast_format *format;
 	struct format_interface *format_interface;
 
-	format = ao2_t_alloc(sizeof(*format), format_destroy, S_OR(codec->description, ""));/* BUGBUG this doesn't need a lock. */
+	format = ao2_t_alloc_options(sizeof(*format), format_destroy,
+		AO2_ALLOC_OPT_LOCK_NOLOCK, S_OR(codec->description, ""));
 	if (!format) {
 		return NULL;
 	}




More information about the svn-commits mailing list