diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2013-08-09 07:38:10 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2013-08-09 07:38:10 +0100 |
commit | f721a7fa14b23c391fed908695491e526c0f2391 (patch) | |
tree | fb89e167d1abd1e9bbcd0ac6bd9812be2336864a | |
parent | 54b6cc2ad64e7954d9e584045c1a0c8724dcb4b7 (diff) | |
download | rabbitmq-server-f721a7fa14b23c391fed908695491e526c0f2391.tar.gz |
refactor: better name for function applicationbug25704
plus lose the type check; we are not that paranoid.
-rw-r--r-- | src/delegate.erl | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/delegate.erl b/src/delegate.erl index 68dc1f34..5277e59f 100644 --- a/src/delegate.erl +++ b/src/delegate.erl @@ -64,7 +64,7 @@ start_link(Num) -> gen_server2:start_link({local, Name}, ?MODULE, [Name], []). invoke(Pid, FunOrMFA) when is_pid(Pid) andalso node(Pid) =:= node() -> - fun_or_mfa(FunOrMFA, Pid); + apply1(FunOrMFA, Pid); invoke(Pid, FunOrMFA) when is_pid(Pid) -> case invoke([Pid], FunOrMFA) of {[{Pid, Result}], []} -> @@ -174,15 +174,13 @@ safe_invoke(Pids, FunOrMFA) when is_list(Pids) -> [safe_invoke(Pid, FunOrMFA) || Pid <- Pids]; safe_invoke(Pid, FunOrMFA) when is_pid(Pid) -> try - {ok, Pid, fun_or_mfa(FunOrMFA, Pid)} + {ok, Pid, apply1(FunOrMFA, Pid)} catch Class:Reason -> {error, Pid, {Class, Reason, erlang:get_stacktrace()}} end. -fun_or_mfa(Fun, Pid) when is_function(Fun) -> - Fun(Pid); -fun_or_mfa({M, F, A}, Pid) -> - apply(M, F, [Pid | A]). +apply1({M, F, A}, Arg) -> apply(M, F, [Arg | A]); +apply1(Fun, Arg) -> Fun(Arg). %%---------------------------------------------------------------------------- |