diff options
author | Björn Gustavsson <[email protected]> | 2016-01-29 12:47:17 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-01-29 13:18:23 +0100 |
commit | eb75295eb95602d0930ce9070447537b7ace22df (patch) | |
tree | 59bd4702990c4448d45b34689b8432459775a2ce /lib/stdlib/src/beam_lib.erl | |
parent | 8a6abf9ac1ce0bae427e202b857d03b89086bb8d (diff) | |
download | otp-eb75295eb95602d0930ce9070447537b7ace22df.tar.gz otp-eb75295eb95602d0930ce9070447537b7ace22df.tar.bz2 otp-eb75295eb95602d0930ce9070447537b7ace22df.zip |
Eliminate redundant double is_function test
When tuple funs were still supported, the idiom for allowing
real funs with a certain arity but not tuple funs was:
is_function(Fun) andalso is_function(Fun, Arity)
The reason that both tests were needed is because:
is_function({M,F}) would return 'false'
is_function({M,F}, Arity) would return 'true'
In 53ec991d19, is_function/2 was updated to only return 'false'
for tuples, so the call to is_function/1 can be removed.
Diffstat (limited to 'lib/stdlib/src/beam_lib.erl')
-rw-r--r-- | lib/stdlib/src/beam_lib.erl | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/stdlib/src/beam_lib.erl b/lib/stdlib/src/beam_lib.erl index 6e00401dce..46aaf84d35 100644 --- a/lib/stdlib/src/beam_lib.erl +++ b/lib/stdlib/src/beam_lib.erl @@ -972,9 +972,7 @@ handle_call({get_crypto_key, What}, From, #state{crypto_key_f=F}=S) -> handle_call({crypto_key_fun, F}, {_,_} = From, S) -> case S#state.crypto_key_f of undefined -> - %% Don't allow tuple funs here. (They weren't allowed before, - %% so there is no reason to allow them now.) - if is_function(F), is_function(F, 1) -> + if is_function(F, 1) -> {Result, Fun, Reply} = case catch F(init) of ok -> |