[asterisk-dev] [svn-commits] junky: trunk r115593 - /trunk/funcs/func_speex.c

Russell Bryant russell at digium.com
Sat May 10 09:55:15 CDT 2008


SVN commits to the Digium repositories wrote:
> Author: junky
> Date: Fri May  9 22:04:25 2008
> New Revision: 115593
> 
> URL: http://svn.digium.com/view/asterisk?view=rev&rev=115593
> Log:
> since we unregister, that has not been properly registered, i standardized this.

This change is not correct.  This module is one of the minority that actually 
properly cleans up in the case of a failure.  It is only unregistering something 
that was already _successfully_ registered in the case that the module is not 
going to completely load.

Furthermore, you made it so the proper return value is not used anymore.  Module 
load functions should _always_ use the AST_MODULE_LOAD_ return values.

> 
> Modified:
>     trunk/funcs/func_speex.c
> 
> Modified: trunk/funcs/func_speex.c
> URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_speex.c?view=diff&rev=115593&r1=115592&r2=115593
> ==============================================================================
> --- trunk/funcs/func_speex.c (original)
> +++ trunk/funcs/func_speex.c Fri May  9 22:04:25 2008
> @@ -336,16 +336,12 @@
>  
>  static int load_module(void)
>  {
> -	if (ast_custom_function_register(&agc_function)) {
> -		return AST_MODULE_LOAD_DECLINE;
> -	}
> -
> -	if (ast_custom_function_register(&denoise_function)) {
> -		ast_custom_function_unregister(&denoise_function);
> -		return AST_MODULE_LOAD_DECLINE;
> -	}
> -
> -	return AST_MODULE_LOAD_SUCCESS;
> +	int res = 0;
> +
> +	res |= ast_custom_function_register(&agc_function);
> +	res |= ast_custom_function_register(&denoise_function);
> +
> +	return res;
>  }
>  
>  AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Noise reduction and Automatic Gain Control (AGC)");
> 
> 
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
> 
> svn-commits mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/svn-commits


-- 
Russell Bryant
Senior Software Engineer
Open Source Team Lead
Digium, Inc.



More information about the asterisk-dev mailing list