summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Nilsson <hans@erlang.org>2021-09-27 11:15:46 +0200
committerHans Nilsson <hans@erlang.org>2021-10-06 10:27:09 +0200
commitbb05db8656f73e6b7edddc0e746dda4e339b1439 (patch)
tree399aa0c0de27fc7ea7384effbb653ab692bf43e2
parent933f3ba618fba7f37d55aa368281b4be587c12d7 (diff)
downloaderlang-bb05db8656f73e6b7edddc0e746dda4e339b1439.tar.gz
crypto: Re-structure existing code
-rw-r--r--lib/crypto/src/crypto.erl22
1 files 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
@@ -403,11 +403,20 @@
%%--------------------------------------------------------------------
+%% 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.
%% If not called from a shell, an error exception will be propagated.
@@ -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 ->