aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh.hrl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-04-06 19:31:13 +0200
committerHans Nilsson <[email protected]>2017-04-07 10:19:56 +0200
commit4d6393bc4df58defbc22c5d97e28bbfdd8794fc6 (patch)
tree37f2957737075a567d05412e9ff0156a88c6182e /lib/ssh/src/ssh.hrl
parent3bbb2c9d5f92205f91cc68b9cebe263b84afe3e2 (diff)
downloadotp-4d6393bc4df58defbc22c5d97e28bbfdd8794fc6.tar.gz
otp-4d6393bc4df58defbc22c5d97e28bbfdd8794fc6.tar.bz2
otp-4d6393bc4df58defbc22c5d97e28bbfdd8794fc6.zip
ssh: Lazy default in get options macro
Diffstat (limited to 'lib/ssh/src/ssh.hrl')
-rw-r--r--lib/ssh/src/ssh.hrl5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ssh/src/ssh.hrl b/lib/ssh/src/ssh.hrl
index e03c15454c..315310f700 100644
--- a/lib/ssh/src/ssh.hrl
+++ b/lib/ssh/src/ssh.hrl
@@ -75,9 +75,12 @@
%% Option access macros
-define(do_get_opt(C,K,O), ssh_options:get_value(C,K,O, ?MODULE,?LINE)).
--define(do_get_opt(C,K,O,D), ssh_options:get_value(C,K,O,D,?MODULE,?LINE)).
+-define(do_get_opt(C,K,O,D), ssh_options:get_value(C,K,O,?LAZY(D),?MODULE,?LINE)).
+
+-define(LAZY(D), fun()-> D end).
-define(GET_OPT(Key,Opts), ?do_get_opt(user_options, Key,Opts ) ).
+-define(GET_OPT(Key,Opts,Def), ?do_get_opt(user_options, Key,Opts,Def) ).
-define(GET_INTERNAL_OPT(Key,Opts), ?do_get_opt(internal_options,Key,Opts ) ).
-define(GET_INTERNAL_OPT(Key,Opts,Def), ?do_get_opt(internal_options,Key,Opts,Def) ).
-define(GET_SOCKET_OPT(Key,Opts), ?do_get_opt(socket_options, Key,Opts ) ).