summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-09-07 07:46:39 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-09-07 21:56:12 -0700
commit90a37de844401a2269dec7d2e2b4b48c934c88c3 (patch)
tree87976c998337fa90e1b897fc6e47536119d0ae63
parentb8ba39ca691b71d2d6f66959c0787693c563dc4f (diff)
downloadtxr-90a37de844401a2269dec7d2e2b4b48c934c88c3.tar.gz
txr-90a37de844401a2269dec7d2e2b4b48c934c88c3.tar.bz2
txr-90a37de844401a2269dec7d2e2b4b48c934c88c3.zip
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.
-rw-r--r--lib.c6
1 files 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));
}
}