Rename MRB_TT_DATA to MRB_TT_CDATA
`TT_DATA` is too confusing with `Data` objects (which is immutable
Struct like objects introduced in Ruby 3.2).
MODIFY
include/mruby/value.h
include/mruby/value.h
@@ -152,7 +152,7 @@ static const unsigned int IEEE754_INFINITY_BITS_SINGLE = 0x7F800000;
f(MRB_TT_RANGE, struct RRange, "Range") \
f(MRB_TT_EXCEPTION, struct RException, "Exception") \
f(MRB_TT_ENV, struct REnv, "env") \
- f(MRB_TT_DATA, struct RData, "Data") \
+ f(MRB_TT_CDATA, struct RData, "C data") \
f(MRB_TT_FIBER, struct RFiber, "Fiber") \
f(MRB_TT_STRUCT, struct RArray, "Struct") \
f(MRB_TT_ISTRUCT, struct RIStruct, "istruct") \
@@ -168,6 +168,9 @@ enum mrb_vtype {
MRB_TT_MAXDEFINE
};
+/* obsolete name for MRB_TT_CDATA */
+#define MRB_TT_DATA MRB_TT_CDATA
+
#define MRB_VTYPE_TYPEOF(tt) MRB_TYPEOF_##tt
#define MRB_VTYPE_TYPEDEF(tt, type, name) typedef type MRB_VTYPE_TYPEOF(tt);
@@ -290,7 +293,7 @@ struct RCptr {
#define mrb_env_p(o) (mrb_type(o) == MRB_TT_ENV)
#endif
#ifndef mrb_data_p
-#define mrb_data_p(o) (mrb_type(o) == MRB_TT_DATA)
+#define mrb_data_p(o) (mrb_type(o) == MRB_TT_CDATA)
#endif
#ifndef mrb_fiber_p
#define mrb_fiber_p(o) (mrb_type(o) == MRB_TT_FIBER)

MODIFY
mrbgems/mruby-io/src/file.c
mrbgems/mruby-io/src/file.c
@@ -594,7 +594,7 @@ mrb_init_file(mrb_state *mrb)
io = mrb_class_get_id(mrb, MRB_SYM(IO));
file = mrb_define_class(mrb, "File", io);
- MRB_SET_INSTANCE_TT(file, MRB_TT_DATA);
+ MRB_SET_INSTANCE_TT(file, MRB_TT_CDATA);
mrb_define_class_method(mrb, file, "umask", mrb_file_s_umask, MRB_ARGS_OPT(1));
mrb_define_class_method(mrb, file, "delete", mrb_file_s_unlink, MRB_ARGS_ANY());
mrb_define_class_method(mrb, file, "unlink", mrb_file_s_unlink, MRB_ARGS_ANY());

MODIFY
mrbgems/mruby-io/src/io.c
mrbgems/mruby-io/src/io.c
@@ -331,7 +331,7 @@ option_to_fd(mrb_state *mrb, mrb_value v)
if (mrb_nil_p(v)) return -1;
switch (mrb_type(v)) {
- case MRB_TT_DATA: /* IO */
+ case MRB_TT_CDATA: /* IO */
return mrb_io_fileno(mrb, v);
case MRB_TT_INTEGER:
return (int)mrb_integer(v);
@@ -1537,7 +1537,7 @@ mrb_init_io(mrb_state *mrb)
struct RClass *io;
io = mrb_define_class(mrb, "IO", mrb->object_class);
- MRB_SET_INSTANCE_TT(io, MRB_TT_DATA);
+ MRB_SET_INSTANCE_TT(io, MRB_TT_CDATA);
mrb_include_module(mrb, io, mrb_module_get(mrb, "Enumerable")); /* 15.2.20.3 */
mrb_define_class_method(mrb, io, "_popen", mrb_io_s_popen, MRB_ARGS_ARG(1,2));

MODIFY
mrbgems/mruby-os-memsize/src/memsize.c
mrbgems/mruby-os-memsize/src/memsize.c
@@ -150,7 +150,7 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj)
size += mrb_bint_memsize(obj);
/* fall through */
#endif
- case MRB_TT_DATA:
+ case MRB_TT_CDATA:
case MRB_TT_ISTRUCT:
size += mrb_objspace_page_slot_size();
break;

MODIFY
mrbgems/mruby-time/src/time.c
mrbgems/mruby-time/src/time.c
@@ -1021,7 +1021,7 @@ mrb_mruby_time_gem_init(mrb_state* mrb)
struct RClass *tc;
/* ISO 15.2.19.2 */
tc = mrb_define_class(mrb, "Time", mrb->object_class);
- MRB_SET_INSTANCE_TT(tc, MRB_TT_DATA);
+ MRB_SET_INSTANCE_TT(tc, MRB_TT_CDATA);
mrb_include_module(mrb, tc, mrb_module_get(mrb, "Comparable"));
mrb_define_class_method(mrb, tc, "at", mrb_time_at_m, MRB_ARGS_ARG(1, 1)); /* 15.2.19.6.1 */
mrb_define_class_method(mrb, tc, "gm", mrb_time_gm, MRB_ARGS_ARG(1,6)); /* 15.2.19.6.2 */

MODIFY
src/class.c
src/class.c
@@ -2749,7 +2749,7 @@ init_copy(mrb_state *mrb, mrb_value dest, mrb_value obj)
case MRB_TT_OBJECT:
case MRB_TT_SCLASS:
case MRB_TT_HASH:
- case MRB_TT_DATA:
+ case MRB_TT_CDATA:
case MRB_TT_EXCEPTION:
mrb_iv_copy(mrb, dest, obj);
break;

MODIFY
src/etc.c
src/etc.c
@@ -16,7 +16,7 @@ mrb_data_object_alloc(mrb_state *mrb, struct RClass *klass, void *ptr, const mrb
{
struct RData *data;
- data = MRB_OBJ_ALLOC(mrb, MRB_TT_DATA, klass);
+ data = MRB_OBJ_ALLOC(mrb, MRB_TT_CDATA, klass);
data->data = ptr;
data->type = type;
@@ -27,7 +27,7 @@ MRB_API void
mrb_data_check_type(mrb_state *mrb, mrb_value obj, const mrb_data_type *type)
{
if (!mrb_data_p(obj)) {
- mrb_check_type(mrb, obj, MRB_TT_DATA);
+ mrb_check_type(mrb, obj, MRB_TT_CDATA);
}
if (DATA_TYPE(obj) != type) {
const mrb_data_type *t2 = DATA_TYPE(obj);
@@ -137,7 +137,7 @@ mrb_obj_id(mrb_value obj)
case MRB_TT_HASH:
case MRB_TT_RANGE:
case MRB_TT_EXCEPTION:
- case MRB_TT_DATA:
+ case MRB_TT_CDATA:
case MRB_TT_ISTRUCT:
default:
return MakeID(mrb_ptr(obj), tt);

MODIFY
src/gc.c
src/gc.c
@@ -696,7 +696,7 @@ gc_mark_children(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj)
/* fall through */
case MRB_TT_OBJECT:
- case MRB_TT_DATA:
+ case MRB_TT_CDATA:
mrb_gc_mark_iv(mrb, (struct RObject*)obj);
break;
@@ -891,7 +891,7 @@ obj_free(mrb_state *mrb, struct RBasic *obj, int end)
mrb_gc_free_range(mrb, ((struct RRange*)obj));
break;
- case MRB_TT_DATA:
+ case MRB_TT_CDATA:
{
struct RData *d = (struct RData*)obj;
if (d->type && d->type->dfree) {
@@ -1010,7 +1010,7 @@ gc_gray_counts(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj)
break;
case MRB_TT_OBJECT:
- case MRB_TT_DATA:
+ case MRB_TT_CDATA:
children += mrb_gc_mark_iv_size(mrb, (struct RObject*)obj);
break;

MODIFY
src/object.c
src/object.c
@@ -378,7 +378,7 @@ mrb_type_convert_check(mrb_state *mrb, mrb_value val, enum mrb_vtype type, mrb_s
{
mrb_value v;
- if (mrb_type(val) == type && type != MRB_TT_DATA && type != MRB_TT_ISTRUCT) return val;
+ if (mrb_type(val) == type && type != MRB_TT_CDATA && type != MRB_TT_ISTRUCT) return val;
v = convert_type(mrb, val, type_name(type), method, FALSE);
if (mrb_nil_p(v) || mrb_type(v) != type) return mrb_nil_value();
return v;

MODIFY
src/variable.c
src/variable.c
@@ -300,7 +300,7 @@ obj_iv_p(mrb_value obj)
case MRB_TT_MODULE:
case MRB_TT_SCLASS:
case MRB_TT_HASH:
- case MRB_TT_DATA:
+ case MRB_TT_CDATA:
case MRB_TT_EXCEPTION:
return TRUE;
default:

Rename MRB_TT_DATA to MRB_TT_CDATA

`TT_DATA` is too confusing with `Data` objects (which is immutable
Struct like objects introduced in Ruby 3.2).