diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-07-14 20:31:55 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-07-14 20:31:55 -0700 |
commit | 3b3f6343ca72bcce408914f94e208cdf8b52cc06 (patch) | |
tree | c205c6ee844e74548054eae4b7858ed53b50b2ff | |
parent | 2830565f6c00ea423c7496cfb3539bdb5625248b (diff) | |
download | txr-3b3f6343ca72bcce408914f94e208cdf8b52cc06.tar.gz txr-3b3f6343ca72bcce408914f94e208cdf8b52cc06.tar.bz2 txr-3b3f6343ca72bcce408914f94e208cdf8b52cc06.zip |
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.
-rw-r--r-- | lib.h | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -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; \ |