[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase2 r307434 - in /team/dvossel/fixthew...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 10 11:14:56 CST 2011


Author: dvossel
Date: Thu Feb 10 11:14:52 2011
New Revision: 307434

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=307434
Log:
fixes merge conflict

Modified:
    team/dvossel/fixtheworld_phase2/   (props changed)
    team/dvossel/fixtheworld_phase2/main/format_cap.c

Propchange: team/dvossel/fixtheworld_phase2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Feb 10 11:14:52 2011
@@ -1,1 +1,1 @@
-/trunk:1-307397
+/trunk:1-307433

Modified: team/dvossel/fixtheworld_phase2/main/format_cap.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/main/format_cap.c?view=diff&rev=307434&r1=307433&r2=307434
==============================================================================
--- team/dvossel/fixtheworld_phase2/main/format_cap.c (original)
+++ team/dvossel/fixtheworld_phase2/main/format_cap.c Thu Feb 10 11:14:52 2011
@@ -456,7 +456,7 @@
 	return NULL;
 }
 
-int ast_format_cap_joint_copy(const struct ast_format_cap *cap1, const struct ast_format_cap *cap2, struct ast_format_cap *result)
+static int joint_copy_helper(const struct ast_format_cap *cap1, const struct ast_format_cap *cap2, struct ast_format_cap *result, int append)
 {
 	struct ao2_iterator it;
 	struct ast_format *tmp;
@@ -464,8 +464,9 @@
 		.joint_cap = result,
 		.joint_found = 0,
 	};
-
-	ast_format_cap_remove_all(result);
+	if (!append) {
+		ast_format_cap_remove_all(result);
+	}
 	it = ao2_iterator_init(cap1->formats, cap2->nolock ? AO2_ITERATOR_DONTLOCK : 0);
 	while ((tmp = ao2_iterator_next(&it))) {
 		data.format = tmp;
@@ -479,27 +480,15 @@
 
 	return ao2_container_count(result->formats) ? 1 : 0;
 }
+
 int ast_format_cap_joint_append(const struct ast_format_cap *cap1, const struct ast_format_cap *cap2, struct ast_format_cap *result)
 {
-	struct ao2_iterator it;
-	struct ast_format *tmp;
-	struct find_joint_data data = {
-		.joint_cap = result,
-		.joint_found = 0,
-	};
-
-	it = ao2_iterator_init(cap1->formats, cap2->nolock ? AO2_ITERATOR_DONTLOCK : 0);
-	while ((tmp = ao2_iterator_next(&it))) {
-		data.format = tmp;
-		ao2_callback(cap2->formats,
-			OBJ_MULTIPLE | OBJ_NODATA | cap2->nolock,
-			find_joint_cb,
-			&data);
-		ao2_ref(tmp, -1);
-	}
-	ao2_iterator_destroy(&it);
-
-	return ao2_container_count(result->formats) ? 1 : 0;
+	return joint_copy_helper(cap1, cap2, result, 1);
+}
+
+int ast_format_cap_joint_copy(const struct ast_format_cap *cap1, const struct ast_format_cap *cap2, struct ast_format_cap *result)
+{
+	return joint_copy_helper(cap1, cap2, result, 0);
 }
 
 struct ast_format_cap *ast_format_cap_get_type(const struct ast_format_cap *cap, enum ast_format_type ftype)




More information about the asterisk-commits mailing list