summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-01-10 08:44:00 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-01-10 08:44:00 -0800
commit866c357da7ef1a2cb45290cb11ef91eb57b10169 (patch)
tree5030c70a084ccc9beb08d69834ae6d0790c8a52f /lib.c
parentd0c3ee7233765e807cf4c8a0615245ac6dcf8996 (diff)
downloadtxr-866c357da7ef1a2cb45290cb11ef91eb57b10169.tar.gz
txr-866c357da7ef1a2cb45290cb11ef91eb57b10169.tar.bz2
txr-866c357da7ef1a2cb45290cb11ef91eb57b10169.zip
GC-correct order in copy_lazy_str.
* lib.c (copy_lazy_str): Eliminate pointless initialization of ls.list and to nil. Make ls.prefix initialization the last step since it's the only operation which conses.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib.c b/lib.c
index cdc7ec1f..2c2e55a1 100644
--- a/lib.c
+++ b/lib.c
@@ -6135,12 +6135,12 @@ static val copy_lazy_str(val lstr)
{
val obj = make_obj();
obj->ls.type = LSTR;
- obj->ls.list = obj->ls.prefix = nil;
- obj->ls.prefix = copy_str(lstr->ls.prefix);
+ obj->ls.prefix = nil;
obj->ls.list = lstr->ls.list;
obj->ls.props = coerce(struct lazy_string_props *,
chk_copy_obj(coerce(mem_t *, lstr->ls.props),
sizeof *lstr->ls.props));
+ obj->ls.prefix = copy_str(lstr->ls.prefix);
return obj;
}