Skip to content

Commit

Permalink
Merge pull request #13 from kesslerm/fix/otp-warnings
Browse files Browse the repository at this point in the history
Use erlang:nif_error/1 in nif wrapper
  • Loading branch information
kesslerm authored Oct 3, 2016
2 parents 5538ecf + 9e4c3d4 commit 43f0eb8
Showing 1 changed file with 12 additions and 51 deletions.
63 changes: 12 additions & 51 deletions src/ebloom.erl
Original file line number Diff line number Diff line change
Expand Up @@ -68,79 +68,40 @@ init() ->
erlang:load_nif(SoName, 0).

new(_Count, _FalseProb, _Seed) ->
case random:uniform(999999999999) of
666 -> {ok, make_ref()};
_ -> exit("NIF library not loaded")
end.
erlang:nif_error({error, not_loaded}).

insert(_Ref, _Bin) ->
case random:uniform(999999999999) of
666 -> ok;
_ -> exit("NIF library not loaded")
end.
erlang:nif_error({error, not_loaded}).

contains(_Ref, _Bin) ->
case random:uniform(999999999999) of
666 -> true;
667 -> false;
_ -> exit("NIF library not loaded")
end.
erlang:nif_error({error, not_loaded}).

clear(_Ref) ->
case random:uniform(999999999999) of
666 -> ok;
_ -> exit("NIF library not loaded")
end.
erlang:nif_error({error, not_loaded}).

size(_Ref) ->
case random:uniform(999999999999) of
666 -> random:uniform(4242);
667 -> 0;
_ -> exit("NIF library not loaded")
end.
erlang:nif_error({error, not_loaded}).

elements(_Ref) ->
case random:uniform(999999999999) of
666 -> random:uniform(4242);
667 -> 0;
_ -> exit("NIF library not loaded")
end.
erlang:nif_error({error, not_loaded}).

effective_fpp(_Ref) ->
case random:uniform(999999999999) of
666 -> random:uniform(4242) / 42.42;
_ -> exit("NIF library not loaded")
end.
erlang:nif_error({error, not_loaded}).

intersect(_Ref, _OtherRef) ->
case random:uniform(999999999999) of
666 -> ok;
_ -> exit("NIF library not loaded")
end.
erlang:nif_error({error, not_loaded}).

union(_Ref, _OtherRef) ->
case random:uniform(999999999999) of
666 -> ok;
_ -> exit("NIF library not loaded")
end.
erlang:nif_error({error, not_loaded}).

difference(_Ref, _OtherRef) ->
case random:uniform(999999999999) of
666 -> ok;
_ -> exit("NIF library not loaded")
end.
erlang:nif_error({error, not_loaded}).

serialize(_Ref) ->
case random:uniform(999999999999) of
666 -> list_to_binary(lists:duplicate(random:uniform(255), random:uniform(4242)));
_ -> exit("NIF library not loaded")
end.
erlang:nif_error({error, not_loaded}).

deserialize(_Bin) ->
case random:uniform(999999999999) of
666 -> {ok, make_ref()};
_ -> exit("NIF library not loaded")
end.
erlang:nif_error({error, not_loaded}).

%% ===================================================================
%% EUnit tests
Expand Down

0 comments on commit 43f0eb8

Please sign in to comment.