remove FL_XXX macros

This commit is contained in:
Yukihiro Matz Matsumoto
2012-11-04 05:15:22 +09:00
parent e429905597
commit 902dd63803
4 changed files with 6 additions and 20 deletions
+2 -16
View File
@@ -161,22 +161,8 @@ mrb_float_value(mrb_float f)
#include "mruby/object.h"
#define IMMEDIATE_P(x) (mrb_type(x) <= MRB_TT_MAIN)
#define SPECIAL_CONST_P(x) IMMEDIATE_P(x)
#define FL_ABLE(x) (!SPECIAL_CONST_P(x))
#define FL_TEST(x,f) (FL_ABLE(x)?(RBASIC(x)->flags&(f)):0)
#define FL_ANY(x,f) FL_TEST(x,f)
#define FL_ALL(x,f) (FL_TEST(x,f) == (f))
#define FL_SET(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags |= (f);} while (0)
#define FL_UNSET(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags &= ~(f);} while (0)
static inline mrb_int
mrb_special_const_p(mrb_value obj)
{
if (SPECIAL_CONST_P(obj)) return 1;
return 0;
}
#define mrb_immediate_p(x) (mrb_type(x) <= MRB_TT_MAIN)
#define mrb_special_const_p(x) mrb_immediate_p(x)
static inline mrb_value
mrb_fixnum_value(mrb_int i)
+1 -1
View File
@@ -1067,7 +1067,7 @@ mrb_ary_equal(mrb_state *mrb, mrb_value ary1)
mrb_get_args(mrb, "o", &ary2);
if (mrb_obj_equal(mrb, ary1, ary2)) return mrb_true_value();
if (SPECIAL_CONST_P(ary2)) return mrb_false_value();
if (mrb_special_const_p(ary2)) return mrb_false_value();
if (!mrb_array_p(ary2)) {
if (!mrb_respond_to(mrb, ary2, mrb_intern(mrb, "to_ary"))) {
return mrb_false_value();
+2 -2
View File
@@ -25,7 +25,7 @@ mrb_data_object_alloc(mrb_state *mrb, struct RClass *klass, void *ptr, const str
void *
mrb_get_datatype(mrb_state *mrb, mrb_value obj, const struct mrb_data_type *type)
{
if (SPECIAL_CONST_P(obj) || (mrb_type(obj) != MRB_TT_DATA)) {
if (mrb_special_const_p(obj) || (mrb_type(obj) != MRB_TT_DATA)) {
return NULL;
}
if (DATA_TYPE(obj) != type) {
@@ -39,7 +39,7 @@ mrb_check_datatype(mrb_state *mrb, mrb_value obj, const struct mrb_data_type *ty
{
static const char mesg[] = "wrong argument type %s (expected %s)";
if (SPECIAL_CONST_P(obj) || (mrb_type(obj) != MRB_TT_DATA)) {
if (mrb_special_const_p(obj) || (mrb_type(obj) != MRB_TT_DATA)) {
mrb_check_type(mrb, obj, MRB_TT_DATA);
}
if (DATA_TYPE(obj) != type) {
+1 -1
View File
@@ -318,7 +318,7 @@ gc_protect(mrb_state *mrb, struct RBasic *p)
void
mrb_gc_protect(mrb_state *mrb, mrb_value obj)
{
if (SPECIAL_CONST_P(obj)) return;
if (mrb_special_const_p(obj)) return;
gc_protect(mrb, RBASIC(obj));
}