mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
string.c (str_unshare_buffer): renamed function for more intuitive name
The old name `str_modify_keep_ascii` does not describe the function behavior. It was named so since it was separated from the function `mrb_str_modify_keep_ascii`.
This commit is contained in:
+3
-3
@@ -223,7 +223,7 @@ str_decref(mrb_state *mrb, mrb_shared_string *shared)
|
||||
}
|
||||
|
||||
static void
|
||||
str_modify_keep_ascii(mrb_state *mrb, struct RString *s)
|
||||
str_unshare_buffer(mrb_state *mrb, struct RString *s)
|
||||
{
|
||||
if (RSTR_SHARED_P(s)) {
|
||||
mrb_shared_string *shared = s->as.heap.aux.shared;
|
||||
@@ -901,7 +901,7 @@ MRB_API void
|
||||
mrb_str_modify_keep_ascii(mrb_state *mrb, struct RString *s)
|
||||
{
|
||||
mrb_check_frozen(mrb, s);
|
||||
str_modify_keep_ascii(mrb, s);
|
||||
str_unshare_buffer(mrb, s);
|
||||
}
|
||||
|
||||
MRB_API void
|
||||
@@ -2578,7 +2578,7 @@ mrb_string_value_cstr(mrb_state *mrb, mrb_value *ptr)
|
||||
* Even after str_modify_keep_ascii(), NULL termination is not ensured if
|
||||
* RSTR_SET_LEN() is used explicitly (e.g. String#delete_suffix!).
|
||||
*/
|
||||
str_modify_keep_ascii(mrb, ps);
|
||||
str_unshare_buffer(mrb, ps);
|
||||
RSTR_PTR(ps)[len] = '\0';
|
||||
return RSTR_PTR(ps);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user