From fddd6110e00df12c99a20a2cc9d074f5f4f1f965 Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Sun, 30 Apr 2017 19:01:47 +0300 Subject: Don't validate an option in gen_mod:get*opt() functions The changes are very similar to those from previous commit: * Now there is no need to pass validating function in gen_mod:get_opt() and gen_mod:get_module_opt() functions, because the modules' configuration keeps already validated values. * New functions gen_mod:get_opt/2 and gen_mod:get_module_opt/3 are introduced. * Functions gen_mod:get_opt/4 and get_module_opt/5 are deprecated. If the functions are still called, the "function" argument is simply ignored. * Validating callback Mod:listen_opt_type/1 is introduced to validate listening options at startup. --- src/misc.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/misc.erl') diff --git a/src/misc.erl b/src/misc.erl index 99612b77d..dae95c6d5 100644 --- a/src/misc.erl +++ b/src/misc.erl @@ -33,7 +33,7 @@ hex_to_bin/1, hex_to_base64/1, expand_keyword/3, atom_to_binary/1, binary_to_atom/1, tuple_to_binary/1, l2i/1, i2l/1, i2l/2, expr_to_term/1, term_to_expr/1, - encode_pid/1, decode_pid/2, compile_exprs/2]). + encode_pid/1, decode_pid/2, compile_exprs/2, join_atoms/2]). %%%=================================================================== %%% API @@ -237,6 +237,10 @@ compile_exprs(Mod, Exprs) -> {error, compile_failed} end. +-spec join_atoms([atom()], binary()) -> binary(). +join_atoms(Atoms, Sep) -> + str:join([io_lib:format("~p", [A]) || A <- Atoms], Sep). + %%%=================================================================== %%% Internal functions %%%=================================================================== -- cgit v1.2.3