Use erlang:nif_error to make dialyzer happy

And mark some of the NIF functions
This commit is contained in:
Carlos Martín Nieto
2013-01-25 02:56:34 +01:00
parent 5ede846988
commit 3c6b1ddaf5
3 changed files with 11 additions and 4 deletions

View File

@@ -15,21 +15,26 @@
hex_to_raw(_Val) ->
nif_error(?LINE).
-spec repository_open(iolist()) -> {ok, term()} | {error, term()}.
repository_open(_Val) ->
nif_error(?LINE).
-spec repository_is_bare(term()) -> boolean().
repository_is_bare(_Handle) ->
nif_error(?LINE).
-spec repository_get_path(term()) -> binary().
repository_get_path(_Val) ->
nif_error(?LINE).
-spec repository_get_workdir(term()) -> binary().
repository_get_workdir(_Handle) ->
nif_error(?LINE).
repository_get_odb(_Val) ->
nif_error(?LINE).
-spec repository_init(iolist(), boolean()) -> term().
repository_init(_Path, _Bare) ->
nif_error(?LINE).
@@ -64,7 +69,7 @@ oid_parse(_Sha) ->
nif_error(?LINE).
nif_error(Line) ->
exit({nif_not_loaded,module,?MODULE,line,Line}).
erlang:nif_error({nif_not_loaded,module,?MODULE,line,Line}).
load_enif() ->
case code:priv_dir(geef) of

View File

@@ -1,3 +1,5 @@
-record(ref, {handle, type}).
-record(ref, {handle, type :: atom()}).
-record(repo, {handle}).
-record(odb, {handle}).
-type repo() :: repo.

View File

@@ -25,7 +25,7 @@ open(Path) ->
Other
end.
-spec init(iolist(), boolean()) -> {ok, term()} | {error, term()}.
-spec init(iolist(), boolean()) -> {ok, repo()} | {error, term()}.
init(Path, Bare) ->
case geef:repository_init(Path, Bare) of
{ok, Handle} ->