[asterisk-commits] file: trunk r43457 - in /trunk: ./ channels/chan_oss.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Sep 21 15:23:30 MST 2006


Author: file
Date: Thu Sep 21 17:23:30 2006
New Revision: 43457

URL: http://svn.digium.com/view/asterisk?rev=43457&view=rev
Log:
Merged revisions 43456 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r43456 | file | 2006-09-21 18:21:40 -0400 (Thu, 21 Sep 2006) | 2 lines

Some more clean up in the load function for chan_oss (issue #8002 reported by Mithraen with minor mods by moi)

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_oss.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-1.4-merged (original)
+++ branch-1.4-merged Thu Sep 21 17:23:30 2006
@@ -1,1 +1,1 @@
-/branches/1.4:1-43376,43383,43386,43388,43392,43396,43405,43410,43422,43441,43445,43450,43454
+/branches/1.4:1-43376,43383,43386,43388,43392,43396,43405,43410,43422,43441,43445,43450,43454,43456

Modified: trunk/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_oss.c?rev=43457&r1=43456&r2=43457&view=diff
==============================================================================
--- trunk/channels/chan_oss.c (original)
+++ trunk/channels/chan_oss.c Thu Sep 21 17:23:30 2006
@@ -1556,39 +1556,39 @@
 
 static int load_module(void)
 {
-	int i;
-	struct ast_config *cfg;
+	struct ast_config *cfg = NULL;
+	char *ctg = NULL;
 
 	/* Copy the default jb config over global_jbconf */
 	memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
 
 	/* load config file */
-	cfg = ast_config_load(config);
-	if (cfg != NULL) {
-		char *ctg = NULL;	/* first pass is 'general' */
-
-		do {
-			store_config(cfg, ctg);
-		} while ( (ctg = ast_category_browse(cfg, ctg)) != NULL);
-		ast_config_destroy(cfg);
-	} else {
-		 ast_log(LOG_NOTICE, "Unable to load config oss.conf\n");
-		 return AST_MODULE_LOAD_DECLINE;
-	}
+	if (!(cfg = ast_config_load(config))) {
+		ast_log(LOG_NOTICE, "Unable to load config %s\n", config);
+		return AST_MODULE_LOAD_DECLINE;
+	}
+
+	do {
+		store_config(cfg, ctg);
+	} while ( (ctg = ast_category_browse(cfg, ctg)) != NULL);
+
+	ast_config_destroy(cfg);
+
 	if (find_desc(oss_active) == NULL) {
 		ast_log(LOG_NOTICE, "Device %s not found\n", oss_active);
 		/* XXX we could default to 'dsp' perhaps ? */
 		/* XXX should cleanup allocated memory etc. */
-		return -1;
-	}
-	i = ast_channel_register(&oss_tech);
-	if (i < 0) {
-		ast_log(LOG_ERROR, "Unable to register channel class 'Console'\n");
-		/* XXX should cleanup allocated memory etc. */
-		return -1;
-	}
+		return AST_MODULE_LOAD_FAILURE;
+	}
+
+	if (ast_channel_register(&oss_tech)) {
+		ast_log(LOG_ERROR, "Unable to register channel class 'MGCP'\n");
+		return AST_MODULE_LOAD_FAILURE;
+	}
+
 	ast_cli_register_multiple(cli_oss, sizeof(cli_oss) / sizeof(struct ast_cli_entry));
-	return 0;
+
+	return AST_MODULE_LOAD_SUCCESS;
 }
 
 



More information about the asterisk-commits mailing list