diff options
author | Lukas Larsson <[email protected]> | 2011-07-05 16:00:07 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2011-08-01 16:38:19 +0200 |
commit | 7c6dbd15b5ce56459606cb1bb6aa719ba9ce4f3c (patch) | |
tree | fc73c2c8ffd96513c5cf503fc12d9c3414212e47 /lib/asn1 | |
parent | a1af48c240079e3923d7eb79511e2539a6713762 (diff) | |
download | otp-7c6dbd15b5ce56459606cb1bb6aa719ba9ce4f3c.tar.gz otp-7c6dbd15b5ce56459606cb1bb6aa719ba9ce4f3c.tar.bz2 otp-7c6dbd15b5ce56459606cb1bb6aa719ba9ce4f3c.zip |
Add load, upgrade and purge functions for asn1 nifs
Diffstat (limited to 'lib/asn1')
-rw-r--r-- | lib/asn1/c_src/asn1_erl_nif.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/asn1/c_src/asn1_erl_nif.c b/lib/asn1/c_src/asn1_erl_nif.c index 2928f098f7..41ce504273 100644 --- a/lib/asn1/c_src/asn1_erl_nif.c +++ b/lib/asn1/c_src/asn1_erl_nif.c @@ -1046,7 +1046,29 @@ static ERL_NIF_TERM decode_ber_tlv(ErlNifEnv* env, int argc, return return_term; } +static int is_ok_load_info(ErlNifEnv* env, ERL_NIF_TERM load_info) { + int i; + return enif_get_int(env, load_info, &i) && i == 1; +} + +static int load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info) { + if (!is_ok_load_info(env, load_info)) + return -1; + return 0; +} + +static int upgrade(ErlNifEnv* env, void** priv_data, void** old_priv_data, + ERL_NIF_TERM load_info) { + if (!is_ok_load_info(env, load_info)) + return -1; + return 0; +} + +static void unload(ErlNifEnv* env, void* priv_data) { + +} + static ErlNifFunc nif_funcs[] = { { "encode_per_complete", 1, encode_per_complete }, { "decode_ber_tlv", 1, decode_ber_tlv } }; -ERL_NIF_INIT(asn1rt_nif, nif_funcs, NULL, NULL, NULL, NULL) +ERL_NIF_INIT(asn1rt_nif, nif_funcs, load, NULL, upgrade, unload) |