[asterisk-commits] file: branch file/bridging r107002 - /team/file/bridging/apps/app_confbridge.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Mar 8 14:13:28 CST 2008


Author: file
Date: Sat Mar  8 14:13:27 2008
New Revision: 107002

URL: http://svn.digium.com/view/asterisk?view=rev&rev=107002
Log:
It's sort of silly to have two flags structures, and to pass in whether it's dynamic or not when we already have it passed in.

Modified:
    team/file/bridging/apps/app_confbridge.c

Modified: team/file/bridging/apps/app_confbridge.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/apps/app_confbridge.c?view=diff&rev=107002&r1=107001&r2=107002
==============================================================================
--- team/file/bridging/apps/app_confbridge.c (original)
+++ team/file/bridging/apps/app_confbridge.c Sat Mar  8 14:13:27 2008
@@ -96,12 +96,11 @@
  * \brief Join a conference bridge
  *
  * \param name The conference name
- * \param dynamic Can the conference bridge be dynamically created
  * \param conference_bridge_user Conference bridge user structure
  *
  * \return A pointer to the conference bridge struct, or NULL if the conference room wasn't found.
  */
-static struct conference_bridge *join_conference_bridge(const char *name, int dynamic, struct conference_bridge_user *conference_bridge_user)
+static struct conference_bridge *join_conference_bridge(const char *name, struct conference_bridge_user *conference_bridge_user)
 {
 	struct conference_bridge *conference_bridge = NULL;
 	int previous_participants = 0;
@@ -127,7 +126,7 @@
 	/* If one was not found try to create one if the dynamic option is set */
 	if (!conference_bridge) {
 		/* Oh dear... the dynamic option was not set or we buggered up and couldn't allocate memory for the darn thing */
-		if (!dynamic || !(conference_bridge = ast_calloc(1, sizeof(*conference_bridge)))) {
+		if (!ast_test_flag(&conference_bridge_user->flags, OPTION_DYNAMIC) || !(conference_bridge = ast_calloc(1, sizeof(*conference_bridge)))) {
 			AST_LIST_UNLOCK(&conference_bridges);
 			ast_log(LOG_ERROR, "Conference bridge '%s' does not exist.\n", name);
 			return NULL;
@@ -298,7 +297,6 @@
 static int app_exec(struct ast_channel *chan, void *data)
 {
 	int res = 0;
-	struct ast_flags flags;
 	char *parse;
 	struct conference_bridge *conference_bridge = NULL;
 	struct ast_bridge_features features;
@@ -321,19 +319,16 @@
 	AST_STANDARD_APP_ARGS(args, parse);
 
 	if (args.argc == 2) {
-		ast_app_parse_options(app_opts, &flags, NULL, args.options);
-	}
-
-	/* Copy flags over to the conference bridge user structure, they may need to be used */
-	ast_copy_flags(&conference_bridge_user.flags, &flags, AST_FLAGS_ALL);
+		ast_app_parse_options(app_opts, &conference_bridge_user.flags, NULL, args.options);
+	}
 
 	/* Look for a conference bridge matching the provided name */
-	if (!(conference_bridge = join_conference_bridge(args.conf_name, ast_test_flag(&flags, OPTION_DYNAMIC), &conference_bridge_user))) {
+	if (!(conference_bridge = join_conference_bridge(args.conf_name, &conference_bridge_user))) {
 		return -1;
 	}
 
 	/* If the menu option is enabled provide a user or admin menu as a custom feature hook */
-	if (ast_test_flag(&flags, OPTION_MENU)) {
+	if (ast_test_flag(&conference_bridge_user.flags, OPTION_MENU)) {
 		ast_bridge_features_init(&features);
 		ast_bridge_features_hook(&features, "#", menu_callback, &conference_bridge_user);
 	}
@@ -345,7 +340,7 @@
 	leave_conference_bridge(conference_bridge, &conference_bridge_user);
 
 	/* Can't forget to clean up the features structure, or else we risk a memory leak */
-	if (ast_test_flag(&flags, OPTION_MENU)) {
+	if (ast_test_flag(&conference_bridge_user.flags, OPTION_MENU)) {
 		ast_bridge_features_cleanup(&features);
 	}
 




More information about the asterisk-commits mailing list