[svn-commits] trunk r17825 - /trunk/pbx/pbx_config.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Apr 6 07:23:39 MST 2006


Author: rizzo
Date: Thu Apr  6 09:23:37 2006
New Revision: 17825

URL: http://svn.digium.com/view/asterisk?rev=17825&view=rev
Log:
split pbx_load_module so we can reduce the indentation depth.
Also convert to MOD_1 style.


Modified:
    trunk/pbx/pbx_config.c

Modified: trunk/pbx/pbx_config.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_config.c?rev=17825&r1=17824&r2=17825&view=diff
==============================================================================
--- trunk/pbx/pbx_config.c (original)
+++ trunk/pbx/pbx_config.c Thu Apr  6 09:23:37 2006
@@ -29,6 +29,8 @@
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
+
+#define STATIC_MODULE
 
 #include "asterisk.h"
 
@@ -1324,7 +1326,7 @@
 /*!
  * Standard module functions ...
  */
-int unload_module(void)
+STATIC_MODULE int unload_module(void)
 {
 	ast_cli_unregister(&context_add_extension_cli);
 	if (static_config && !write_protect_config)
@@ -1339,7 +1341,7 @@
 	return 0;
 }
 
-static int pbx_load_module(void)
+static void pbx_load_config(const char *config_file)
 {
 	struct ast_config *cfg;
 	char *end;
@@ -1348,8 +1350,10 @@
 	int lastpri = -2;
 	struct ast_context *con;
 
-	cfg = ast_config_load(config);
-	if (cfg) {
+	cfg = ast_config_load(config_file);
+	if (!cfg)
+		return;
+	{
 		struct ast_variable *v;
 		char *cxt;
 
@@ -1504,7 +1508,15 @@
 		}
 		ast_config_destroy(cfg);
 	}
-	ast_merge_contexts_and_delete(&local_contexts,registrar);
+
+}
+
+static int pbx_load_module(void)
+{
+	struct ast_context *con;
+
+	pbx_load_config(config);
+	ast_merge_contexts_and_delete(&local_contexts, registrar);
 
 	for (con = NULL; (con = ast_walk_contexts(con));)
 		ast_context_verify_includes(con);
@@ -1514,7 +1526,7 @@
 	return 0;
 }
 
-int load_module(void)
+STATIC_MODULE int load_module(void)
 {
 	if (pbx_load_module()) return -1;
  
@@ -1531,7 +1543,7 @@
 	return 0;
 }
 
-int reload(void)
+STATIC_MODULE int reload(void)
 {
 	ast_context_destroy(NULL, registrar);
 	if (clearglobalvars_config)
@@ -1540,17 +1552,19 @@
 	return 0;
 }
 
-int usecount(void)
+STATIC_MODULE int usecount(void)
 {
 	return 0;
 }
 
-char *description(void)
+STATIC_MODULE char *description(void)
 {
 	return dtext;
 }
 
-char *key(void)
+STATIC_MODULE char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }
+
+STD_MOD(MOD_1, reload, NULL, NULL);



More information about the svn-commits mailing list