diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-01-21 22:02:13 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-01-21 22:34:50 -0800 |
commit | c5e67375817d057e5d4d1f0c793effe40c868291 (patch) | |
tree | 13824ee00447b80955a8efc329b7208208589075 /socket.c | |
parent | ce6c1ff37c9709b98c464b4b79199b249f6185dc (diff) | |
download | txr-c5e67375817d057e5d4d1f0c793effe40c868291.tar.gz txr-c5e67375817d057e5d4d1f0c793effe40c868291.tar.bz2 txr-c5e67375817d057e5d4d1f0c793effe40c868291.zip |
bugfix: several predicates return 1 instead of t.
Firstly, I'm fixing an odd bug here: cobjclassp returns 1
instead of t to represent true. This affects: carrayp, hashp,
random-state-p, regexp and struct-type-p, all of which
return 1 when the test is true. For some bizarre reason, I
chose this weird solution back in 2019 because this function
has some calls at init time when t is not yet available;
simply returning t causes a segfault.
Secondly, I'm fixing the way we deal with t at initialization
time. We simply give it a temporary value of 1 until it is
replaced with the real symbol. This fixes all the original
problems with t being nil until initialized. Now, we cannot
do this:
val t = one;
because one is not a constant expression due to the cast,
even though one is a de-facto constant. That's probably what
distraced me away from the obvious second-best solution of
just assigning it at some early point in the execution.
* lib.c (cobjclassp): Fix odd bug here: returning one to
indicate true instead of t. (make_sym): Don't test value of t here any more.
(make_package_common): Don't use lit("t") instead of t any
more in the make_hash calls.
(make_package): Don't test value of t here.
(obj_init): t can now be initialized using the straightforward
expression t = intern(lit("t"), user_package), similarly
to other symbols.
(init): set t to the integer 1 before making any init calls.
Diffstat (limited to 'socket.c')
0 files changed, 0 insertions, 0 deletions