From b82b93f8f0c229e94a89469b0754bab0e28cd17c Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Sat, 29 Apr 2017 11:39:40 +0300 Subject: Don't validate an option in ejabberd_config:get_option() functions The commit introduces the following changes: * Now there is no need to pass validating function in ejabberd_config:get_option() functions, because the configuration keeps already validated values. * New function ejabberd_config:get_option/1 is introduced * Function ejabberd_config:get_option/3 is deprecated. If the function is still called, the second argument (validating function) is simply ignored. * The second argument for ejabberd_config:get_option/2 is now a default value, not a validating function. --- src/ejabberd_sql_sup.erl | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/ejabberd_sql_sup.erl') diff --git a/src/ejabberd_sql_sup.erl b/src/ejabberd_sql_sup.erl index 59360a9f9..7526aedbe 100644 --- a/src/ejabberd_sql_sup.erl +++ b/src/ejabberd_sql_sup.erl @@ -62,15 +62,8 @@ start_link(Host) -> init([Host]) -> StartInterval = ejabberd_config:get_option( {sql_start_interval, Host}, - fun(I) when is_integer(I), I>0 -> I end, ?DEFAULT_SQL_START_INTERVAL), - Type = ejabberd_config:get_option({sql_type, Host}, - fun(mysql) -> mysql; - (pgsql) -> pgsql; - (sqlite) -> sqlite; - (mssql) -> mssql; - (odbc) -> odbc - end, odbc), + Type = ejabberd_config:get_option({sql_type, Host}, odbc), PoolSize = get_pool_size(Type, Host), case Type of sqlite -> @@ -119,7 +112,6 @@ remove_pid(Host, Pid) -> get_pool_size(SQLType, Host) -> PoolSize = ejabberd_config:get_option( {sql_pool_size, Host}, - fun(I) when is_integer(I), I>0 -> I end, case SQLType of sqlite -> 1; _ -> ?DEFAULT_POOL_SIZE -- cgit v1.2.3