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.
This commit is contained in:
parent
d5a5333168
commit
8a8618d4f3
Notes:
git
2023-06-01 12:32:50 +00:00
4
string.c
4
string.c
@ -3057,13 +3057,9 @@ str_buf_cat4(VALUE str, const char *ptr, long len, bool keep_cr)
|
|||||||
|
|
||||||
if (STR_EMBED_P(str)) {
|
if (STR_EMBED_P(str)) {
|
||||||
capa = str_embed_capa(str) - termlen;
|
capa = str_embed_capa(str) - termlen;
|
||||||
sptr = RSTRING(str)->as.embed.ary;
|
|
||||||
olen = RSTRING_EMBED_LEN(str);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
capa = RSTRING(str)->as.heap.aux.capa;
|
capa = RSTRING(str)->as.heap.aux.capa;
|
||||||
sptr = RSTRING(str)->as.heap.ptr;
|
|
||||||
olen = RSTRING(str)->as.heap.len;
|
|
||||||
}
|
}
|
||||||
if (olen > LONG_MAX - len) {
|
if (olen > LONG_MAX - len) {
|
||||||
rb_raise(rb_eArgError, "string sizes too big");
|
rb_raise(rb_eArgError, "string sizes too big");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user