From 90a37de844401a2269dec7d2e2b4b48c934c88c3 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 7 Sep 2021 07:46:39 -0700 Subject: string-extend: use num, not num_fast. * lib.c (string_extend, string_finish): When we update the alloc value in the string, we should be using num, because the cnum value is not necessarily in the fixnum range. That's the whole reason we are using the set macro: because the assigned value could be a heap-allocated bignum. Which it will never be, if we use num_fast. --- lib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib.c b/lib.c index cdfb5742..3e9cca80 100644 --- a/lib.c +++ b/lib.c @@ -4826,11 +4826,11 @@ val string_extend(val str, val tail, val finish_in) if (alloc != oalloc) { str->st.str = chk_wrealloc(str->st.str, alloc); - set(mkloc(str->st.alloc, str), num_fast(alloc)); + set(mkloc(str->st.alloc, str), num(alloc)); } } - set(mkloc(str->st.len, str), num_fast(len + delta)); + set(mkloc(str->st.len, str), num(len + delta)); if (stringp(tail)) { wmemcpy(str->st.str + len, c_str(tail, self), delta + 1); @@ -4855,7 +4855,7 @@ val string_finish(val str) if (alloc > len + 1) { alloc = len + 1; str->st.str = chk_wrealloc(str->st.str, alloc); - set(mkloc(str->st.alloc, str), num_fast(alloc)); + set(mkloc(str->st.alloc, str), num(alloc)); } } -- cgit v1.2.3