object.h: unify MRB_FROZEN_P() and mrb_frozen_p()

This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-01-07 11:24:58 +09:00
parent 21003746df
commit c11d18e426
3 changed files with 3 additions and 4 deletions
+1 -2
View File
@@ -23,10 +23,9 @@ struct RBasic {
#define mrb_basic_ptr(v) ((struct RBasic*)(mrb_ptr(v)))
#define MRB_OBJ_IS_FROZEN 1
#define MRB_FROZEN_P(o) ((o)->frozen)
#define mrb_frozen_p(o) ((o)->frozen)
#define MRB_SET_FROZEN_FLAG(o) ((o)->frozen = 1)
#define MRB_UNSET_FROZEN_FLAG(o) ((o)->frozen = 0)
#define mrb_frozen_p(o) MRB_FROZEN_P(o)
struct RObject {
MRB_OBJECT_HEADER;
+1 -1
View File
@@ -768,7 +768,7 @@ mrb_define_method_raw(mrb_state *mrb, struct RClass *c, mrb_sym mid, mrb_method_
}
}
else {
mrb_assert(MRB_FROZEN_P(p) && MRB_PROC_SCOPE_P(p));
mrb_assert(mrb_frozen_p(p) && MRB_PROC_SCOPE_P(p));
mrb_assert(p->c == NULL && p->upper == NULL && p->e.target_class == NULL);
}
}
+1 -1
View File
@@ -987,7 +987,7 @@ ht_rehash(mrb_state *mrb, struct RHash *h)
static mrb_value
h_key_for(mrb_state *mrb, mrb_value key)
{
if (mrb_string_p(key) && !MRB_FROZEN_P(mrb_str_ptr(key))) {
if (mrb_string_p(key) && !mrb_frozen_p(mrb_str_ptr(key))) {
key = mrb_str_dup(mrb, key);
MRB_SET_FROZEN_FLAG(mrb_str_ptr(key));
}