[asterisk-commits] mmichelson: trunk r390787 - /trunk/main/features_config.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 6 18:32:14 CDT 2013


Author: mmichelson
Date: Thu Jun  6 18:32:13 2013
New Revision: 390787

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390787
Log:
Conditionally reject duplicate entries in applicationmap containers.

When reading from a config file, it's important to reject duplicates. Otherwise,
featuregroups will have ambiguity when pointing to applicationmap items. However,
when constructing the channel's current applicationmap, we don't care about duplicate
names since it's the DTMF that identifies a feature, not the name.


Modified:
    trunk/main/features_config.c

Modified: trunk/main/features_config.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/features_config.c?view=diff&rev=390787&r1=390786&r2=390787
==============================================================================
--- trunk/main/features_config.c (original)
+++ trunk/main/features_config.c Thu Jun  6 18:32:13 2013
@@ -418,10 +418,11 @@
 	return cfg;
 }
 
-static struct ao2_container *applicationmap_alloc(void)
+static struct ao2_container *applicationmap_alloc(int reject_duplicates)
 {
 	return ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK,
-			AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, applicationmap_sort, NULL);
+			reject_duplicates ? AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT : AO2_CONTAINER_ALLOC_OPT_DUPS_ALLOW,
+			applicationmap_sort, NULL);
 }
 
 /*!
@@ -457,7 +458,7 @@
 	}
 
 	if (allocate_applicationmap) {
-		cfg->applicationmap = applicationmap_alloc();
+		cfg->applicationmap = applicationmap_alloc(1);
 		if (!cfg->applicationmap) {
 			return NULL;
 		}
@@ -999,7 +1000,7 @@
 		return NULL;
 	}
 
-	applicationmap = applicationmap_alloc();
+	applicationmap = applicationmap_alloc(0);
 	if (!applicationmap) {
 		return NULL;
 	}




More information about the asterisk-commits mailing list