diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-07-29 07:51:02 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-07-29 07:51:02 -0700 |
commit | 13994ed823c2445bbeecea677fd604744b373c5e (patch) | |
tree | dccbf9179283db3e7760319a4689a76697d5dba1 /tests | |
parent | a7f9a8749ab3eae450c2a447782e9a9c034057ea (diff) | |
download | txr-13994ed823c2445bbeecea677fd604744b373c5e.tar.gz txr-13994ed823c2445bbeecea677fd604744b373c5e.tar.bz2 txr-13994ed823c2445bbeecea677fd604744b373c5e.zip |
gc: problem in several object copying functions.
The functions copy-cons, copy-tree, copy-fun and copy-tnode have a
problem. They copy the original object bitwise with a structure
assignment, and then make some adjustments. The problem is that this
inappropriately copies the object's metadata related to gc, such as its
generation number or finalization count. To fix this, we introduce a
copy_obj function, which is a companion to make_obj. This performs a
shallow copy of an object without incorrectly propagating inappropriate
metadata.
* gc.c, gc.h (copy_obj): New function.
* lib.c (copy_fun, copy_cons, copy_tree): Use copy_obj, instead of
make_obj plus structure assignment.
* tree.c (copy_tnode): Likewise.
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions