class.c: rename mt_/MT_ to mrb_mt_/MRB_MT_ for non-static identifiers

Follow mruby's naming convention: non-static types, macros, and
functions use the mrb_/MRB_ prefix. Renamed:
- union mt_ptr -> union mrb_mt_ptr
- mt_tbl -> mrb_mt_tbl
- MT_KEY(), MT_FUNC, MT_NOARG, MT_PUBLIC, MT_PRIVATE -> MRB_MT_*
- MT_KEY_SHIFT, MT_READONLY_BIT, MT_REMOVED_P -> MRB_MT_*
- mt_init_rom() -> mrb_mt_init_rom()
File-local static functions and macros in class.c are unchanged.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2026-02-19 15:22:55 +09:00
parent 494d55c9f7
commit 0ed26f8352
35 changed files with 1030 additions and 1030 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ MRB_BEGIN_DECL
struct RClass {
MRB_OBJECT_HEADER;
struct iv_tbl *iv;
struct mt_tbl *mt;
struct mrb_mt_tbl *mt;
struct RClass *super;
};
+18 -18
View File
@@ -29,34 +29,34 @@ size_t mrb_class_mt_memsize(mrb_state*, struct RClass*);
mrb_value mrb_obj_extend(mrb_state*, mrb_value obj);
/* ROM method table types for static method registration */
union mt_ptr {
union mrb_mt_ptr {
const struct RProc *proc;
mrb_func_t func;
};
typedef struct mt_tbl {
int size;
int alloc; /* bit 30: MT_READONLY_BIT */
union mt_ptr *ptr;
struct mt_tbl *next;
} mt_tbl;
typedef struct mrb_mt_tbl {
int size;
int alloc; /* bit 30: MRB_MT_READONLY_BIT */
union mrb_mt_ptr *ptr;
struct mrb_mt_tbl *next;
} mrb_mt_tbl;
#define MT_READONLY_BIT (1 << 30)
#define MT_KEY_SHIFT 4
#define MT_KEY(sym, flags) ((sym)<<MT_KEY_SHIFT|(flags))
#define MT_FUNC 8 /* MRB_METHOD_FUNC_FL */
#define MT_NOARG 4 /* MRB_METHOD_NOARG_FL */
#define MT_PUBLIC 0 /* MRB_METHOD_PUBLIC_FL */
#define MT_PRIVATE 1 /* MRB_METHOD_PRIVATE_FL */
#define MRB_MT_READONLY_BIT (1 << 30)
#define MRB_MT_KEY_SHIFT 4
#define MRB_MT_KEY(sym, flags) ((sym)<<MRB_MT_KEY_SHIFT|(flags))
#define MRB_MT_FUNC 8 /* MRB_METHOD_FUNC_FL */
#define MRB_MT_NOARG 4 /* MRB_METHOD_NOARG_FL */
#define MRB_MT_PUBLIC 0 /* MRB_METHOD_PUBLIC_FL */
#define MRB_MT_PRIVATE 1 /* MRB_METHOD_PRIVATE_FL */
/* "removed" tombstone: MT_FUNC flag set with NULL function pointer.
/* "removed" tombstone: MRB_MT_FUNC flag set with NULL function pointer.
This combination never occurs naturally (C functions are never NULL).
Unlike undef (proc=NULL without MT_FUNC), a removed marker makes
Unlike undef (proc=NULL without MRB_MT_FUNC), a removed marker makes
mt_get() return 0 ("not found"), blocking ROM chain walk while
allowing superclass lookup. */
#define MT_REMOVED_P(key, val) (((key)&MT_FUNC) && (val).func==NULL)
#define MRB_MT_REMOVED_P(key, val) (((key)&MRB_MT_FUNC) && (val).func==NULL)
void mrb_mt_init_rom(struct RClass *c, mt_tbl *rom);
void mrb_mt_init_rom(struct RClass *c, mrb_mt_tbl *rom);
#endif
mrb_value mrb_obj_equal_m(mrb_state *mrb, mrb_value);