Use list_to_existing_atom/1 wherever possible

This commit is contained in:
Evgeny Khramtsov 2019-06-15 15:14:45 +03:00
parent 31050f5b09
commit e84391a6a9
5 changed files with 5 additions and 5 deletions

View File

@ -194,7 +194,7 @@ code_change(_OldVsn, State, _Extra) ->
%%%===================================================================
get_mod() ->
Backend = ejabberd_option:cluster_backend(),
list_to_atom("ejabberd_cluster_" ++ atom_to_list(Backend)).
list_to_existing_atom("ejabberd_cluster_" ++ atom_to_list(Backend)).
rpc_timeout() ->
ejabberd_option:rpc_timeout().

View File

@ -565,7 +565,7 @@ process(_Handlers, _Request) ->
get_db_backend() ->
DBType = ejabberd_option:oauth_db_type(),
list_to_atom("ejabberd_oauth_" ++ atom_to_list(DBType)).
list_to_existing_atom("ejabberd_oauth_" ++ atom_to_list(DBType)).
%% Headers as per RFC 6749

View File

@ -429,7 +429,7 @@ get_domain_balancing(From, To, LDomain) ->
-spec get_backend() -> module().
get_backend() ->
DBType = ejabberd_option:router_db_type(),
list_to_atom("ejabberd_router_" ++ atom_to_list(DBType)).
list_to_existing_atom("ejabberd_router_" ++ atom_to_list(DBType)).
-spec cache_nodes(module()) -> [node()].
cache_nodes(Mod) ->

View File

@ -881,7 +881,7 @@ force_update_presence({LUser, LServer}) ->
get_sm_backend(Host) ->
DBType = ejabberd_option:sm_db_type(Host),
list_to_atom("ejabberd_sm_" ++ atom_to_list(DBType)).
list_to_existing_atom("ejabberd_sm_" ++ atom_to_list(DBType)).
-spec get_sm_backends() -> [module()].

View File

@ -353,7 +353,7 @@ db_mod(Opt, Host, Module) when is_binary(Host) orelse Host == global ->
db_mod(Opt, Opts, Module) when is_map(Opts) ->
db_mod(Opt, get_opt(Opt, Opts), Module);
db_mod(_Opt, Type, Module) when is_atom(Type) ->
list_to_atom(atom_to_list(Module) ++ "_" ++ atom_to_list(Type)).
list_to_existing_atom(atom_to_list(Module) ++ "_" ++ atom_to_list(Type)).
-spec loaded_modules(binary()) -> [atom()].
loaded_modules(Host) ->