diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-01-09 15:50:04 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-01-09 15:50:04 -0800 |
commit | 1020794b7ff51a4f168a73343f0674e71b0b279b (patch) | |
tree | 8520c2e17e3c4b2d4752658fe0c0bee6f5d72829 /gc.c | |
parent | 4e119128f89115dc5e1b00c00c2567ad550a04c3 (diff) | |
download | txr-1020794b7ff51a4f168a73343f0674e71b0b279b.tar.gz txr-1020794b7ff51a4f168a73343f0674e71b0b279b.tar.bz2 txr-1020794b7ff51a4f168a73343f0674e71b0b279b.zip |
Use struct instead of cons for lazy string fields.
* gc.c (finalize): Must free the dynamic structure attached
to the LSTR type now.
(mark_obj): Must mark interior of LSTR type's props structure.
* lib.c (lazy_sub_str, copy_lazy_str): Copy props structure.
(lazy_str): Allocate and initialize props structure.
(lazy_str_force, lazy_str_put, lazy_str_force_upto,
lazy_str_get_trailing_list, out_lazy_str): Follow
representation change.
* lib.h (struct lazy_string_props): New struct type.
(strut lazy_string): Member opts replaced with props
pointer to struct lazy_string_props.
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -230,7 +230,6 @@ static void finalize(val obj) case PKG: case FUN: case LCONS: - case LSTR: case ENV: case FLNUM: case RNG: @@ -243,6 +242,10 @@ static void finalize(val obj) free(obj->st.str); obj->st.str = 0; return; + case LSTR: + free(obj->ls.props); + obj->ls.props = 0; + return; case VEC: free(obj->v.vec-2); obj->v.vec = 0; @@ -351,7 +354,8 @@ tail_call: mark_obj_tail(obj->lc.cdr); case LSTR: mark_obj(obj->ls.prefix); - mark_obj(obj->ls.opts); + mark_obj(obj->ls.props->limit); + mark_obj(obj->ls.props->term); mark_obj_tail(obj->ls.list); case COBJ: obj->co.ops->mark(obj); |