зеркало из https://github.com/github/ruby.git
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:
Родитель
d5a5333168
Коммит
8a8618d4f3
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)) {
|
||||
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");
|
||||
|
|
Загрузка…
Ссылка в новой задаче