[svn-commits] kpfleming: branch markster/usersconf r40752 - /team/markster/usersconf/main/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sun Aug 20 20:21:27 MST 2006


Author: kpfleming
Date: Sun Aug 20 22:21:27 2006
New Revision: 40752

URL: http://svn.digium.com/view/asterisk?rev=40752&view=rev
Log:
restore changes that had been made in core files lost during the merge

Modified:
    team/markster/usersconf/main/config.c
    team/markster/usersconf/main/pbx.c

Modified: team/markster/usersconf/main/config.c
URL: http://svn.digium.com/view/asterisk/team/markster/usersconf/main/config.c?rev=40752&r1=40751&r2=40752&view=diff
==============================================================================
--- team/markster/usersconf/main/config.c (original)
+++ team/markster/usersconf/main/config.c Sun Aug 20 22:21:27 2006
@@ -146,6 +146,16 @@
 
 	return (cat) ? cat->root : NULL;
 }
+
+char *ast_config_option(struct ast_config *cfg, const char *cat, const char *var)
+{
+	char *tmp;
+	tmp = ast_variable_retrieve(cfg, cat, var);
+	if (!tmp)
+		tmp = ast_variable_retrieve(cfg, "general", var);
+	return tmp;
+}
+
 
 char *ast_variable_retrieve(const struct ast_config *config, const char *category, const char *variable)
 {

Modified: team/markster/usersconf/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/markster/usersconf/main/pbx.c?rev=40752&r1=40751&r2=40752&view=diff
==============================================================================
--- team/markster/usersconf/main/pbx.c (original)
+++ team/markster/usersconf/main/pbx.c Sun Aug 20 22:21:27 2006
@@ -3487,7 +3487,7 @@
 	return tmp ? 0 : -1;
 }
 
-struct ast_context *ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar)
+static struct ast_context *__ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar, int existsokay)
 {
 	struct ast_context *tmp, **local_contexts;
 	int length = sizeof(struct ast_context) + strlen(name) + 1;
@@ -3500,10 +3500,13 @@
 
 	for (tmp = *local_contexts; tmp; tmp = tmp->next) {
 		if (!strcasecmp(tmp->name, name)) {
-			ast_log(LOG_WARNING, "Tried to register context '%s', already in use\n", name);
+			if (!existsokay) {
+				ast_log(LOG_WARNING, "Tried to register context '%s', already in use\n", name);
+				tmp = NULL;
+			}
 			if (!extcontexts)
 				ast_mutex_unlock(&conlock);
-			return NULL;
+			return tmp;
 		}
 	}
 	if ((tmp = ast_calloc(1, length))) {
@@ -3527,6 +3530,15 @@
 	return tmp;
 }
 
+struct ast_context *ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar)
+{
+	return __ast_context_create(extcontexts, name, registrar, 0);
+}
+
+struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, const char *name, const char *registrar)
+{
+	return __ast_context_create(extcontexts, name, registrar, 1);
+}
 void __ast_context_destroy(struct ast_context *con, const char *registrar);
 
 struct store_hint {



More information about the svn-commits mailing list