[asterisk-commits] file: branch file/chan_jingle2 r369004 - /team/file/chan_jingle2/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 15 11:05:08 CDT 2012


Author: file
Date: Fri Jun 15 11:05:04 2012
New Revision: 369004

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369004
Log:
Incorporate more review feedback.

Modified:
    team/file/chan_jingle2/channels/chan_jingle2.c

Modified: team/file/chan_jingle2/channels/chan_jingle2.c
URL: http://svnview.digium.com/svn/asterisk/team/file/chan_jingle2/channels/chan_jingle2.c?view=diff&rev=369004&r1=369003&r2=369004
==============================================================================
--- team/file/chan_jingle2/channels/chan_jingle2.c (original)
+++ team/file/chan_jingle2/channels/chan_jingle2.c Fri Jun 15 11:05:04 2012
@@ -317,6 +317,12 @@
 	ast_string_field_free_memory(endpoint);
 }
 
+/*! \brief Find function for Jingle endpoints */
+static void *jingle_endpoint_find(struct ao2_container *tmp_container, const char *category)
+{
+	return ao2_find(tmp_container, category, OBJ_KEY);
+}
+
 /*! \brief Allocator function for Jingle endpoint state */
 static struct jingle_endpoint_state *jingle_endpoint_state_create(void)
 {
@@ -339,8 +345,8 @@
 {
 	RAII_VAR(struct jingle_config *, cfg, ao2_global_obj_ref(globals), ao2_cleanup);
 	RAII_VAR(struct jingle_endpoint *, endpoint, NULL, ao2_cleanup);
-	
-	if (!cfg || !cfg->endpoints || !(endpoint = ao2_find(cfg->endpoints, category, OBJ_KEY))) {
+
+	if (!cfg || !cfg->endpoints || !(endpoint = jingle_endpoint_find(cfg->endpoints, category))) {
 		return jingle_endpoint_state_create();
 	}
 
@@ -393,26 +399,20 @@
 	return !strcmp(endpoint1->name, flags & OBJ_KEY ? name : endpoint2->name) ? CMP_MATCH | CMP_STOP : 0;
 }
 
-/*! \brief Find function for Jingle endpoints */
-static void *jingle_endpoint_find(struct ao2_container *tmp_container, const char *category)
-{
-	return ao2_find(tmp_container, category, OBJ_KEY);
-}
-
 static struct aco_type endpoint_option = {
-        .type = ACO_ITEM,
-        .category_match = ACO_BLACKLIST,
-        .category = "^general$",
-        .item_alloc = jingle_endpoint_alloc,
-        .item_find = jingle_endpoint_find,
-        .item_offset = offsetof(struct jingle_config, endpoints),
+	.type = ACO_ITEM,
+	.category_match = ACO_BLACKLIST,
+	.category = "^general$",
+	.item_alloc = jingle_endpoint_alloc,
+	.item_find = jingle_endpoint_find,
+	.item_offset = offsetof(struct jingle_config, endpoints),
 };
 
 struct aco_type *endpoint_options[] = ACO_TYPES(&endpoint_option);
 
 struct aco_file jingle_conf = {
-        .filename = "jingle2.conf",
-        .types = ACO_TYPES(&endpoint_option),
+	.filename = "jingle2.conf",
+	.types = ACO_TYPES(&endpoint_option),
 };
 
 /*! \brief Destructor for Jingle sessions */
@@ -446,25 +446,25 @@
 /*! \brief Destructor called when module configuration goes away */
 static void jingle_config_destructor(void *obj)
 {
-        struct jingle_config *cfg = obj;
-        ao2_cleanup(cfg->endpoints);
+	struct jingle_config *cfg = obj;
+	ao2_cleanup(cfg->endpoints);
 }
 
 /*! \brief Allocator called when module configuration should appear */
 static void *jingle_config_alloc(void)
 {
-        struct jingle_config *cfg;
-
-        if (!(cfg = ao2_alloc(sizeof(*cfg), jingle_config_destructor))) {
-                return NULL;
-        }
-
-        if (!(cfg->endpoints = ao2_container_alloc(ENDPOINT_BUCKETS, jingle_endpoint_hash, jingle_endpoint_cmp))) {
-                ao2_ref(cfg, -1);
-                return NULL;
-        }
-
-        return cfg;
+	struct jingle_config *cfg;
+
+	if (!(cfg = ao2_alloc(sizeof(*cfg), jingle_config_destructor))) {
+		return NULL;
+	}
+
+	if (!(cfg->endpoints = ao2_container_alloc(ENDPOINT_BUCKETS, jingle_endpoint_hash, jingle_endpoint_cmp))) {
+		ao2_ref(cfg, -1);
+		return NULL;
+	}
+
+	return cfg;
 }
 
 CONFIG_INFO_STANDARD(cfg_info, globals, jingle_config_alloc,
@@ -820,7 +820,7 @@
 		if (!(local_candidate = iks_new("candidate"))) {
 			res = -1;
 			ast_log(LOG_ERROR, "Unable to allocate IKS candidate stanza for Google ICE transport\n");
-			goto end;
+			break;
 		}
 
 		/* We only support RTP candidates */
@@ -861,7 +861,6 @@
 		candidates[i++] = local_candidate;
 	}
 
-end:
 	ao2_iterator_destroy(&it);
 	ao2_ref(local_candidates, -1);
 
@@ -1708,7 +1707,7 @@
 		return NULL;
 	}
 
-	if (!(endpoint = ao2_find(cfg->endpoints, args.name, OBJ_KEY))) {
+	if (!(endpoint = jingle_endpoint_find(cfg->endpoints, args.name))) {
 		ast_log(LOG_ERROR, "Endpoint '%s' does not exist.\n", args.name);
 		*cause = AST_CAUSE_CHANNEL_UNACCEPTABLE;
 		return NULL;




More information about the asterisk-commits mailing list