Skip to content

Commit b47bead

Browse files
committed
MFAs 🤦
1 parent f375561 commit b47bead

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

lib/safe_nif/runner.ex

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ defmodule SafeNIF.Runner do
77
defguardp is_runnable(runnable)
88
when is_function(runnable, 0) or
99
(is_tuple(runnable) and
10-
is_atom(
11-
elem(runnable, 0) and is_list(elem(runnable, 2)) and
12-
is_function(elem(runnable, 1), length(elem(runnable, 2)))
13-
))
10+
is_atom(elem(runnable, 0)) and
11+
is_atom(elem(runnable, 1)) and
12+
is_list(elem(runnable, 2)))
1413

1514
def start_link({ref, runnable, caller} = init_arg)
1615
when is_reference(ref) and is_runnable(runnable) and is_pid(caller) do

lib/safe_nif/wrapped_call.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ defmodule SafeNIF.WrappedCall do
88
end
99
end
1010

11-
def call(pid, {mod, fun, args}) when is_atom(mod) and is_list(args) and is_function(fun, length(args)) do
11+
def call(pid, {mod, fun, args}) when is_atom(mod) and is_atom(fun) and is_list(args) do
1212
{__MODULE__, :wrapped, [pid, mod, fun, args]}
1313
end
1414

1515
@doc false
16-
def wrapped(pid, mod, fun, args) when is_atom(mod) and is_list(args) and is_function(fun, length(args)) do
16+
def wrapped(pid, mod, fun, args) when is_atom(mod) and is_atom(fun) and is_list(args) do
1717
result = apply(mod, fun, args)
1818
send(pid, {:ok, result})
1919
end

0 commit comments

Comments
 (0)