summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-05-31 09:57:33 -0400
committerPeter Zhu <peter@peterzhu.ca>2023-06-01 08:32:29 -0400
commit8a8618d4f3b35a5f114a3a5e05c80a7edb30546c (patch)
treeb5d2dc31d778163c764b6c27817b8703c68c6895
parentd5a5333168690ea1e3453cdb6a5d042f46ba80b8 (diff)
Don't refetch ptr and len
The call to RSTRING_GETMEM already fetched the pointer and length, so we don't need to fetch it again.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7879
-rw-r--r--string.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/string.c b/string.c
index df1464fb70..aba5f47535 100644
--- a/string.c
+++ b/string.c
@@ -3057,13 +3057,9 @@ str_buf_cat4(VALUE str, const char *ptr, long len, bool keep_cr)
if (STR_EMBED_P(str)) {
capa = str_embed_capa(str) - termlen;
- sptr = RSTRING(str)->as.embed.ary;
- olen = RSTRING_EMBED_LEN(str);
}
else {
capa = RSTRING(str)->as.heap.aux.capa;
- sptr = RSTRING(str)->as.heap.ptr;
- olen = RSTRING(str)->as.heap.len;
}
if (olen > LONG_MAX - len) {
rb_raise(rb_eArgError, "string sizes too big");