[asterisk-commits] russell: trunk r115850 - in /trunk: apps/ funcs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 13 12:42:17 CDT 2008


Author: russell
Date: Tue May 13 12:42:17 2008
New Revision: 115850

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115850
Log:
Re-introduce proper error handling that was removed in recent commits.

Modified:
    trunk/apps/app_jack.c
    trunk/apps/app_skel.c
    trunk/funcs/func_speex.c

Modified: trunk/apps/app_jack.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_jack.c?view=diff&rev=115850&r1=115849&r2=115850
==============================================================================
--- trunk/apps/app_jack.c (original)
+++ trunk/apps/app_jack.c Tue May 13 12:42:17 2008
@@ -977,12 +977,16 @@
 
 static int load_module(void)
 {
-	int res = 0;
-
-	res |= ast_register_application(jack_app, jack_exec, jack_synopsis, jack_desc);
-	res |= ast_custom_function_register(&jack_hook_function);
-
-	return res;
+	if (ast_register_application(jack_app, jack_exec, jack_synopsis, jack_desc)) {
+		return AST_MODULE_LOAD_DECLINE;
+	}
+
+	if (ast_custom_function_register(&jack_hook_function)) {
+		ast_unregister_application(jack_app);
+		return AST_MODULE_LOAD_DECLINE;
+	}
+
+	return AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "JACK Interface");

Modified: trunk/apps/app_skel.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_skel.c?view=diff&rev=115850&r1=115849&r2=115850
==============================================================================
--- trunk/apps/app_skel.c (original)
+++ trunk/apps/app_skel.c Tue May 13 12:42:17 2008
@@ -114,7 +114,8 @@
 
 static int load_module(void)
 {
-	return ast_register_application(app, app_exec, synopsis, descrip);
+	return ast_register_application(app, app_exec, synopsis, descrip) ? 
+		AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Skeleton (sample) Application");

Modified: trunk/funcs/func_speex.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_speex.c?view=diff&rev=115850&r1=115849&r2=115850
==============================================================================
--- trunk/funcs/func_speex.c (original)
+++ trunk/funcs/func_speex.c Tue May 13 12:42:17 2008
@@ -336,12 +336,16 @@
 
 static int load_module(void)
 {
-	int res = 0;
-
-	res |= ast_custom_function_register(&agc_function);
-	res |= ast_custom_function_register(&denoise_function);
-
-	return res;
+	if (ast_custom_function_register(&agc_function)) {
+		return AST_MODULE_LOAD_DECLINE;
+	}
+
+	if (ast_custom_function_register(&denoise_function)) {
+		ast_custom_function_unregister(&agc_function);
+		return AST_MODULE_LOAD_DECLINE;
+	}
+
+	return AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Noise reduction and Automatic Gain Control (AGC)");




More information about the asterisk-commits mailing list