From 0a5acc0303a5565c9eaaa43cfeacdbf7d9d6a708 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 7 Jan 2025 14:26:57 +0900 Subject: [PATCH] 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`. --- src/string.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/string.c b/src/string.c index ae932aa37..2f29449db 100644 --- a/src/string.c +++ b/src/string.c @@ -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); }