mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
struct RString member should not be mrb_value
This commit is contained in:
+7
-7
@@ -492,13 +492,13 @@ str_new4(mrb_state *mrb, enum mrb_vtype ttype, mrb_value str)
|
||||
RSTRING(str2)->buf = RSTRING_PTR(str);
|
||||
|
||||
if (MRB_STR_SHARED_P(str)) {
|
||||
mrb_value shared = RSTRING_SHARED(str);
|
||||
struct RString *shared = RSTRING_SHARED(str);
|
||||
FL_SET(str2, MRB_STR_SHARED);
|
||||
RSTRING_SHARED(str2) = shared;
|
||||
}
|
||||
else {
|
||||
FL_SET(str, MRB_STR_SHARED);
|
||||
RSTRING_SHARED(str) = str2;
|
||||
RSTRING_SHARED(str) = mrb_str_ptr(str2);
|
||||
}
|
||||
mrb_enc_cr_str_exact_copy(mrb, str2, str);
|
||||
return str2;
|
||||
@@ -2185,7 +2185,7 @@ str_replace_shared(mrb_state *mrb, mrb_value str2, mrb_value str)
|
||||
str = mrb_str_new_frozen(mrb, str);
|
||||
RSTRING(str2)->len = RSTRING_LEN(str);
|
||||
RSTRING(str2)->buf = RSTRING_PTR(str);
|
||||
RSTRING_SHARED(str2) = str;
|
||||
RSTRING_SHARED(str2) = mrb_str_ptr(str);
|
||||
FL_SET(str2, MRB_STR_SHARED);
|
||||
mrb_enc_cr_str_exact_copy(mrb, str2, str);
|
||||
|
||||
@@ -2220,9 +2220,9 @@ mrb_str_new_frozen(mrb_state *mrb, mrb_value orig)
|
||||
|
||||
klass = mrb_obj_class(mrb, orig);
|
||||
|
||||
if (MRB_STR_SHARED_P(orig) && !mrb_nil_p(RSTRING_SHARED(orig))) {
|
||||
if (MRB_STR_SHARED_P(orig) && RSTRING_SHARED(orig)) {
|
||||
long ofs;
|
||||
ofs = RSTRING_LEN(str) - RSTRING_LEN(orig);
|
||||
ofs = RSTRING_LEN(str) - RSTRING_SHARED(orig)->len;
|
||||
#ifdef INCLUDE_ENCODING
|
||||
if ((ofs > 0) || (klass != RBASIC(str)->c) ||
|
||||
ENCODING_GET(mrb, str) != ENCODING_GET(mrb, orig)) {
|
||||
@@ -2776,9 +2776,9 @@ str_replace(mrb_state *mrb, mrb_value str, mrb_value str2)
|
||||
|
||||
len = RSTRING_LEN(str2);
|
||||
if (MRB_STR_SHARED_P(str2)) {
|
||||
mrb_value shared = RSTRING_SHARED(str2);
|
||||
struct RString *shared = RSTRING_SHARED(str2);
|
||||
RSTRING_LEN(str) = len;
|
||||
RSTRING_PTR(str) = RSTRING_PTR(str2);
|
||||
RSTRING_PTR(str) = shared->buf;
|
||||
FL_SET(str, MRB_STR_SHARED);
|
||||
RSTRING_SHARED(str) = shared;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user