diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-05-30 09:07:20 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-05-30 09:07:20 -0700 |
commit | ecf92c96cc73cfc25a0ab98a6a0070c87465bc22 (patch) | |
tree | be5e5f1bee013ee63d85354114b3d9a137baddad /ffi.h | |
parent | f3225cb0e6bfaf17709b0c171e77cd58fb198ce1 (diff) | |
download | txr-ecf92c96cc73cfc25a0ab98a6a0070c87465bc22.tar.gz txr-ecf92c96cc73cfc25a0ab98a6a0070c87465bc22.tar.bz2 txr-ecf92c96cc73cfc25a0ab98a6a0070c87465bc22.zip |
tree: different fix for dummy node issue.
Let's restore the previous commit and fix it differently.
The real problem is that the tn_flatten function does not need
to use the set macro.
When the flattened tree is rebuilt with tn_build_tree, every
left and right link of every node is set at that time. That
function uses the set macro, so all is well.
The dummy node is not pulled into the rebuild, so it doesn't
cause any problem; the dummy node is only mutated in
tn_flatten.
This is a better fix not only because tn_flatten is now more
efficient. It is important for the dummy node to look like it
is a generation zero object. The dummy node ends up as the
pseudo-root of the tree, which means that it if it looks like
it is in generation 1, all generation 0 below it will be
wastefully checked by the garbage collector.
* tree.c (tn_flatten): Do not use the set macro. Just use
straight assignment to convert the tree into a linked list.
(tr_rebuild): Restore dummy node to be all zeros.
Diffstat (limited to 'ffi.h')
0 files changed, 0 insertions, 0 deletions