aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Hogan <[email protected]>2019-01-03 21:15:31 -0800
committerDoug Hogan <[email protected]>2019-01-08 01:11:57 -0800
commit1ad4eb810f83a43c531eebafd8784a2c76d7869e (patch)
treef891afb9e8c1fba4dd3cef2f3d83acea5f4c3fac
parentf7d64513a055dce87c050cffc578f641dc86258e (diff)
downloadotp-1ad4eb810f83a43c531eebafd8784a2c76d7869e.tar.gz
otp-1ad4eb810f83a43c531eebafd8784a2c76d7869e.tar.bz2
otp-1ad4eb810f83a43c531eebafd8784a2c76d7869e.zip
Revamp engine_unregister_nif()
-rw-r--r--lib/crypto/c_src/engine.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/crypto/c_src/engine.c b/lib/crypto/c_src/engine.c
index 7dc0151018..5f742757e8 100644
--- a/lib/crypto/c_src/engine.c
+++ b/lib/crypto/c_src/engine.c
@@ -487,15 +487,12 @@ ERL_NIF_TERM engine_unregister_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM
unsigned int method;
// Get Engine
- if (!enif_get_resource(env, argv[0], engine_ctx_rtype, (void**)&ctx)) {
- PRINTF_ERR0("engine_unregister_nif Leaved: Parameter not an engine resource object");
- return enif_make_badarg(env);
- }
- // Get Method
- if (!enif_get_uint(env, argv[1], &method)) {
- PRINTF_ERR0("engine_unregister_nif Leaved: Parameter Method not an uint");
- return enif_make_badarg(env);
- }
+ if (argc != 2)
+ goto bad_arg;
+ if (!enif_get_resource(env, argv[0], engine_ctx_rtype, (void**)&ctx))
+ goto bad_arg;
+ if (!enif_get_uint(env, argv[1], &method))
+ goto bad_arg;
switch(method)
{
@@ -562,7 +559,12 @@ ERL_NIF_TERM engine_unregister_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM
default:
break;
}
+
return atom_ok;
+
+ bad_arg:
+ return enif_make_badarg(env);
+
#else
return atom_notsup;
#endif