[asterisk-commits] russell: branch russell/chan_console r81446 - /team/russell/chan_console/chan...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 4 13:09:17 CDT 2007


Author: russell
Date: Tue Sep  4 13:09:17 2007
New Revision: 81446

URL: http://svn.digium.com/view/asterisk?view=rev&rev=81446
Log:
slightly simplify the centralized error handling in load_module

Modified:
    team/russell/chan_console/channels/chan_console.c

Modified: team/russell/chan_console/channels/chan_console.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/channels/chan_console.c?view=diff&rev=81446&r1=81445&r2=81446
==============================================================================
--- team/russell/chan_console/channels/chan_console.c (original)
+++ team/russell/chan_console/channels/chan_console.c Tue Sep  4 13:09:17 2007
@@ -980,11 +980,6 @@
 {
 	PaError res;
 	struct console_pvt *pvt = &console_pvt;
-	struct {
-		unsigned int pa_init:1;
-		unsigned int chan_reg:1;
-		unsigned int cli_reg:1;
-	} load_flags = { 0, };
 
 	ast_cond_init(&pvt->cond, NULL);
 
@@ -995,27 +990,26 @@
 	if (res != paNoError) {
 		ast_log(LOG_WARNING, "Failed to initialize audio system - (%d) %s\n",
 			res, Pa_GetErrorText(res));
-		goto return_error;
-	}
-	load_flags.pa_init = 1;
+		goto return_error_pa_init;
+	}
 
 	if (ast_channel_register(&console_tech)) {
 		ast_log(LOG_ERROR, "Unable to register channel type 'Console'\n");
-		goto return_error;
-	}
-	load_flags.chan_reg = 1;
+		goto return_error_chan_reg;
+	}
 
 	if (ast_cli_register_multiple(cli_console, ARRAY_LEN(cli_console)))
-		goto return_error;
+		goto return_error_cli_reg;
 
 	return AST_MODULE_LOAD_SUCCESS;
 
+return_error_cli_reg:
+	ast_cli_unregister_multiple(cli_console, ARRAY_LEN(cli_console));
+return_error_chan_reg:
+	ast_channel_unregister(&console_tech);
+return_error_pa_init:
+	Pa_Terminate();
 return_error:
-	ast_cli_unregister_multiple(cli_console, ARRAY_LEN(cli_console));
-	if (load_flags.chan_reg)
-		ast_channel_unregister(&console_tech);
-	if (load_flags.pa_init)
-		Pa_Terminate();
 	ast_cond_destroy(&pvt->cond);
 
 	return AST_MODULE_LOAD_DECLINE;




More information about the asterisk-commits mailing list