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 07:46:39 -0700
commitbddeae89f69a50f98e486632a77b35a7f0675294 (patch)
tree87976c998337fa90e1b897fc6e47536119d0ae63
parent472942e65dc0816185b309ac0ba4eca2d87428f8 (diff)
downloadtxr-bddeae89f69a50f98e486632a77b35a7f0675294.tar.gz
txr-bddeae89f69a50f98e486632a77b35a7f0675294.tar.bz2
txr-bddeae89f69a50f98e486632a77b35a7f0675294.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));
}
}