[Asterisk-code-review] codec speex.c: Cleanup module loading to DECLINE and not FAI... (asterisk[master])
George Joseph
asteriskteam at digium.com
Fri Oct 5 14:30:41 CDT 2018
George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/10436 )
Change subject: codec_speex.c: Cleanup module loading to DECLINE and not FAILURE.
......................................................................
codec_speex.c: Cleanup module loading to DECLINE and not FAILURE.
If codec_speex fails to register a translator it would cause Asterisk to
exit instead of continue as a DECLINED module.
* Make unload_module() always return 0. It is silly to fail unloading if
any translators we try to unregister were not even registered.
Change-Id: Ia262591f68333dad17673ba7104d11c88096f51a
---
M codecs/codec_speex.c
1 file changed, 12 insertions(+), 14 deletions(-)
Approvals:
Corey Farrell: Looks good to me, but someone else must approve
Benjamin Keith Ford: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
diff --git a/codecs/codec_speex.c b/codecs/codec_speex.c
index 591fce9..0354bd5 100644
--- a/codecs/codec_speex.c
+++ b/codecs/codec_speex.c
@@ -689,39 +689,37 @@
static int unload_module(void)
{
- int res = 0;
+ ast_unregister_translator(&speextolin);
+ ast_unregister_translator(&lintospeex);
+ ast_unregister_translator(&speexwbtolin16);
+ ast_unregister_translator(&lin16tospeexwb);
+ ast_unregister_translator(&speexuwbtolin32);
+ ast_unregister_translator(&lin32tospeexuwb);
- res |= ast_unregister_translator(&speextolin);
- res |= ast_unregister_translator(&lintospeex);
- res |= ast_unregister_translator(&speexwbtolin16);
- res |= ast_unregister_translator(&lin16tospeexwb);
- res |= ast_unregister_translator(&speexuwbtolin32);
- res |= ast_unregister_translator(&lin32tospeexuwb);
-
-
- return res;
+ return 0;
}
static int load_module(void)
{
int res = 0;
- if (parse_config(0))
+ if (parse_config(0)) {
return AST_MODULE_LOAD_DECLINE;
+ }
+ /* XXX It is most likely a bug in this module if we fail to register a translator */
res |= ast_register_translator(&speextolin);
res |= ast_register_translator(&lintospeex);
res |= ast_register_translator(&speexwbtolin16);
res |= ast_register_translator(&lin16tospeexwb);
res |= ast_register_translator(&speexuwbtolin32);
res |= ast_register_translator(&lin32tospeexuwb);
-
if (res) {
unload_module();
- return res;
+ return AST_MODULE_LOAD_DECLINE;
}
- return res;
+ return AST_MODULE_LOAD_SUCCESS;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Speex Coder/Decoder",
--
To view, visit https://gerrit.asterisk.org/10436
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia262591f68333dad17673ba7104d11c88096f51a
Gerrit-Change-Number: 10436
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2 (1000185)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181005/d9dc0e02/attachment.html>
More information about the asterisk-code-review
mailing list