mruby.h: reorganize `mrb_ensure/check` functions in headers.
MODIFY
include/mruby.h
include/mruby.h
@@ -1368,6 +1368,15 @@ MRB_API void mrb_gc_register(mrb_state *mrb, mrb_value obj);
/* mrb_gc_unregister() removes the object from GC root. */
MRB_API void mrb_gc_unregister(mrb_state *mrb, mrb_value obj);
+/* type conversion/check functions */
+MRB_API mrb_value mrb_ensure_array_type(mrb_state *mrb, mrb_value self);
+MRB_API mrb_value mrb_check_array_type(mrb_state *mrb, mrb_value self);
+MRB_API mrb_value mrb_ensure_hash_type(mrb_state *mrb, mrb_value hash);
+MRB_API mrb_value mrb_check_hash_type(mrb_state *mrb, mrb_value hash);
+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)
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/array.h
include/mruby/array.h
@@ -204,8 +204,6 @@ MRB_API void mrb_ary_set(mrb_state *mrb, mrb_value ary, mrb_int n, mrb_value val
* @param other The array to replace it with.
*/
MRB_API void mrb_ary_replace(mrb_state *mrb, mrb_value self, mrb_value other);
-MRB_API mrb_value mrb_ensure_array_type(mrb_state *mrb, mrb_value self);
-MRB_API mrb_value mrb_check_array_type(mrb_state *mrb, mrb_value self);
/*
* Unshift an element into the array

MODIFY
include/mruby/hash.h
include/mruby/hash.h
@@ -37,8 +37,6 @@ struct RHash {
size_t mrb_hash_memsize(mrb_value obj);
MRB_API mrb_value mrb_hash_new_capa(mrb_state *mrb, mrb_int capa);
-MRB_API mrb_value mrb_ensure_hash_type(mrb_state *mrb, mrb_value hash);
-MRB_API mrb_value mrb_check_hash_type(mrb_state *mrb, mrb_value hash);
/*
* Initializes a new hash.

MODIFY
include/mruby/string.h
include/mruby/string.h
@@ -324,20 +324,6 @@ MRB_API mrb_value mrb_str_resize(mrb_state *mrb, mrb_value str, mrb_int len);
*/
MRB_API mrb_value mrb_str_substr(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len);
-/**
- * Returns a Ruby string type.
- *
- *
- * @param mrb The current mruby state.
- * @param str Ruby string.
- * @return [mrb_value] A Ruby string.
- */
-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 */
-MRB_API mrb_value mrb_string_type(mrb_state *mrb, mrb_value str);
-
-
MRB_API mrb_value mrb_str_new_capa(mrb_state *mrb, size_t capa);
#define mrb_str_buf_new(mrb, capa) mrb_str_new_capa(mrb, (capa))

MODIFY
src/object.c
src/object.c
@@ -564,13 +564,6 @@ mrb_to_str(mrb_state *mrb, mrb_value val)
return mrb_ensure_string_type(mrb, val);
}
-/* obsolete: use mrb_ensure_string_type() instead */
-MRB_API mrb_value
-mrb_string_type(mrb_state *mrb, mrb_value str)
-{
- return mrb_ensure_string_type(mrb, str);
-}
-
MRB_API mrb_value
mrb_ensure_string_type(mrb_state *mrb, mrb_value str)
{

mruby.h: reorganize `mrb_ensure/check` functions in headers.