]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Re-introduce proper error handling that was removed in recent commits.
authorRussell Bryant <russell@russellbryant.com>
Tue, 13 May 2008 17:42:17 +0000 (17:42 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 13 May 2008 17:42:17 +0000 (17:42 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115850 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_jack.c
apps/app_skel.c
funcs/func_speex.c

index 2aa253f9b82e967f5a39facd0883bd8c07cae82b..1b5f4e73825c6162f54204d2882d2e170e18a361 100644 (file)
@@ -977,12 +977,16 @@ static int unload_module(void)
 
 static int load_module(void)
 {
-       int res = 0;
+       if (ast_register_application(jack_app, jack_exec, jack_synopsis, jack_desc)) {
+               return AST_MODULE_LOAD_DECLINE;
+       }
 
-       res |= ast_register_application(jack_app, jack_exec, jack_synopsis, jack_desc);
-       res |= ast_custom_function_register(&jack_hook_function);
+       if (ast_custom_function_register(&jack_hook_function)) {
+               ast_unregister_application(jack_app);
+               return AST_MODULE_LOAD_DECLINE;
+       }
 
-       return res;
+       return AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "JACK Interface");
index 061f1e87cfb8cdd039bb60866683d85f8896f613..588563d2fae9bbdc79cc822e57ff2669a6516b77 100644 (file)
@@ -114,7 +114,8 @@ static int unload_module(void)
 
 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");
index f4d5fe412e4bb6b1df467260bc4f93cf6161e255..fc4eb8e3eccb40f530fcb432c1b8b1f83bd29230 100644 (file)
@@ -336,12 +336,16 @@ static int unload_module(void)
 
 static int load_module(void)
 {
-       int res = 0;
+       if (ast_custom_function_register(&agc_function)) {
+               return AST_MODULE_LOAD_DECLINE;
+       }
 
-       res |= ast_custom_function_register(&agc_function);
-       res |= ast_custom_function_register(&denoise_function);
+       if (ast_custom_function_register(&denoise_function)) {
+               ast_custom_function_unregister(&agc_function);
+               return AST_MODULE_LOAD_DECLINE;
+       }
 
-       return res;
+       return AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Noise reduction and Automatic Gain Control (AGC)");