From 35b47325f3f99077cbc3b731bfe80b6ee2351d53 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 14 Jul 2021 20:31:55 -0700 Subject: lib: default_arg_strict becomes macro. * lib.h (default_arg_strict): Inline function converted to macro, so that we can suppress the evaluation of the default expression if it is not required. The default_arg_strict idiom is being used all over the stream library now. The common default value expressions like std_out are macros that access the dynamic variable by symbol. We don't want to be wastefully doing that on each stream operation, whether or not a stream argument has been supplied. --- lib.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib.h b/lib.h index 07ff1edf..7f227b53 100644 --- a/lib.h +++ b/lib.h @@ -1286,10 +1286,7 @@ INLINE val default_null_arg(val arg) return if3(missingp(arg), nil, arg); } -INLINE val default_arg_strict(val arg, val dfl) -{ - return if3(missingp(arg), dfl, arg); -} +#define default_arg_strict(arg, dfl) if3(missingp(arg), dfl, arg) #define list_collect_decl(OUT, PTAIL) \ val OUT = nil; \ -- cgit v1.2.3