string.h: obsolete `mrb_str_to_str()`, even from examples.
MODIFY
examples/mrbgems/c_and_ruby_extension_example/src/example.c
examples/mrbgems/c_and_ruby_extension_example/src/example.c
static mrb_value
mrb_c_method(mrb_state *mrb, mrb_value self)
{
- mrb_value self_str = mrb_str_to_str(mrb, self);
-
- printf("%s: A C Extension\n", mrb_str_to_cstr(mrb, self_str));
+ mrb_ensure_string_type(mrb, self);
+ printf("%s: A C Extension\n", mrb_str_to_cstr(mrb, self));
return self;
}

MODIFY
examples/mrbgems/c_extension_example/src/example.c
examples/mrbgems/c_extension_example/src/example.c
static mrb_value
mrb_c_method(mrb_state *mrb, mrb_value self)
{
- mrb_value self_str = mrb_str_to_str(mrb, self);
-
- printf("%s: A C Extension\n", mrb_str_to_cstr(mrb, self_str));
+ mrb_ensure_string_type(mrb, self);
+ printf("%s: A C Extension\n", mrb_str_to_cstr(mrb, self));
return self;
}

MODIFY
include/mruby.h
include/mruby.h
@@ -1377,6 +1377,9 @@ MRB_API mrb_value mrb_ensure_string_type(mrb_state *mrb, mrb_value str);
MRB_API mrb_value mrb_check_string_type(mrb_state *mrb, mrb_value str);
/* obsolete: use mrb_ensure_string_type() instead */
#define mrb_string_type(mrb, str) mrb_ensure_string_type(mrb,str)
+/* obsolete: use mrb_obj_as_string() instead */
+#define mrb_str_to_str(mrb, str) mrb_obj_as_string(mrb, str)
+
MRB_API mrb_value mrb_to_int(mrb_state *mrb, mrb_value val);
#define mrb_as_int(mrb, val) mrb_integer(mrb_to_int(mrb, val))

MODIFY
include/mruby/string.h
include/mruby/string.h
@@ -358,13 +358,6 @@ MRB_API mrb_value mrb_str_intern(mrb_state *mrb, mrb_value self);
MRB_API mrb_value mrb_str_to_inum(mrb_state *mrb, mrb_value str, mrb_int base, mrb_bool badcheck);
MRB_API double mrb_str_to_dbl(mrb_state *mrb, mrb_value str, mrb_bool badcheck);
-/**
- * Returns a converted string type.
- * For type checking, non converting `mrb_to_str` is recommended.
- * obsolete: use `mrb_obj_as_string()` instead.
- */
-#define mrb_str_to_str(mrb, str) mrb_obj_as_string(mrb, str)
-
/**
* Returns true if the strings match and false if the strings don't match.
*

string.h: obsolete `mrb_str_to_str()`, even from examples.