From bb05db8656f73e6b7edddc0e746dda4e339b1439 Mon Sep 17 00:00:00 2001 From: Hans Nilsson Date: Mon, 27 Sep 2021 11:15:46 +0200 Subject: crypto: Re-structure existing code --- lib/crypto/src/crypto.erl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl index 49aa3c5f1c..b7f3acb57c 100644 --- a/lib/crypto/src/crypto.erl +++ b/lib/crypto/src/crypto.erl @@ -402,11 +402,20 @@ -type descriptive_error() :: any() . +%%-------------------------------------------------------------------- +%% Compilation and loading %%-------------------------------------------------------------------- -compile(no_native). -on_load(on_load/0). -define(CRYPTO_NIF_VSN,302). +%%-------------------------------------------------------------------- +%% When generating documentation from crypto.erl, the macro ?CRYPTO_VSN is not defined. +%% That causes the doc generation to stop... +-ifndef(CRYPTO_VSN). +-define(CRYPTO_VSN, "??"). +-endif. + %%-------------------------------------------------------------------- %% Call a nif and handle an error exceptions to fit into the error handling %% in the Erlang shell. @@ -436,23 +445,14 @@ %% Error if the crypto nifs not are loaded -define(nif_stub,nif_stub_error(?LINE)). - nif_stub_error(Line) -> erlang:nif_error({nif_not_loaded,module,?MODULE,line,Line}). %%-------------------------------------------------------------------- %%% API %%-------------------------------------------------------------------- -%% Crypto app version history: -%% (no version): Driver implementation -%% 2.0 : NIF implementation, requires OTP R14 - -%% When generating documentation from crypto.erl, the macro ?CRYPTO_VSN is not defined. -%% That causes the doc generation to stop... --ifndef(CRYPTO_VSN). --define(CRYPTO_VSN, "??"). --endif. -version() -> ?CRYPTO_VSN. +version() -> + ?CRYPTO_VSN. format_error({Ex, {C_file,C_line}, Msg}, [{_M,_F,_Args,Opts} | _CallStack]) when Ex == badarg ; Ex == notsup -> -- cgit v1.2.1