diff options
| author | Yuichi Nishiwaki <[email protected]> | 2013-08-04 00:40:41 -0700 |
|---|---|---|
| committer | Yuichi Nishiwaki <[email protected]> | 2013-08-04 00:40:41 -0700 |
| commit | 8854ecb629726e24aef03183b36fe3b1314dfb91 (patch) | |
| tree | a98fa3f7ca68170857fc81d3ed83cdb02953678d | |
| parent | 07fefb585e2d2265c63f5ce83b83ab38f06a8e49 (diff) | |
| download | mruby-8854ecb629726e24aef03183b36fe3b1314dfb91.tar.gz mruby-8854ecb629726e24aef03183b36fe3b1314dfb91.zip | |
revert one of the API changes: MRB_SET_VALUE_P no longer used
| -rw-r--r-- | include/mruby/value.h | 20 | ||||
| -rw-r--r-- | src/class.c | 2 | ||||
| -rw-r--r-- | src/vm.c | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/include/mruby/value.h b/include/mruby/value.h index e98d3ce14..8971aca41 100644 --- a/include/mruby/value.h +++ b/include/mruby/value.h @@ -152,12 +152,14 @@ typedef struct mrb_value { #define MRB_SET_VALUE(o, tt, attr, v) do {\ (o).value.ttt = mrb_mktt(tt);\ - (o).attr = v;\ -} while (0) -#define MRB_SET_VALUE_P(o, tt, v) do {\ - (o).value.ttt = mrb_mktt(tt);\ - (o).value.i = 0;\ - (o).value.p = (void*)((uint64_t)(o).value.p | (((uint64_t)(v))>>2));\ + switch (tt) {\ + case MRB_TT_FALSE:\ + case MRB_TT_TRUE:\ + case MRB_TT_UNDEF:\ + case MRB_TT_FIXNUM:\ + case MRB_TT_SYMBOL: (o).attr = (v); break;\ + default: (o).value.i = 0; (o).value.p = (void*)((uint64_t)(o).value.p | (((uint64_t)(v))>>2)); break;\ + }\ } while (0) static inline mrb_value @@ -252,7 +254,6 @@ typedef union mrb_value { default: if ((o).value.bp) (o).value.bp->tt = ttt; break;\ }\ } while (0) -#define MRB_SET_VALUE_P(o, ttt, v) MRB_SET_VALUE(o, ttt, value.p, v) extern mrb_value mrb_float_value(struct mrb_state *mrb, mrb_float f); @@ -279,7 +280,6 @@ typedef struct mrb_value { (o).tt = ttt;\ (o).attr = v;\ } while (0) -#define MRB_SET_VALUE_P(o, ttt, v) MRB_SET_VALUE(o, ttt, value.p, v) static inline mrb_value mrb_float_value(struct mrb_state *mrb, mrb_float f) @@ -426,7 +426,7 @@ mrb_obj_value(void *p) mrb_value v; struct RBasic *b = (struct RBasic*)p; - MRB_SET_VALUE_P(v, b->tt, p); + MRB_SET_VALUE(v, b->tt, value.p, p); return v; } @@ -439,7 +439,7 @@ mrb_voidp_value(struct mrb_state *mrb, void *p) { mrb_value v; - MRB_SET_VALUE_P(v, MRB_TT_VOIDP, p); + MRB_SET_VALUE(v, MRB_TT_VOIDP, value.p, p); return v; } #endif diff --git a/src/class.c b/src/class.c index 4331becae..6d77f24e6 100644 --- a/src/class.c +++ b/src/class.c @@ -1438,7 +1438,7 @@ undef_method(mrb_state *mrb, struct RClass *c, mrb_sym a) mrb_name_error(mrb, a, "undefined method '%S' for class '%S'", mrb_sym2str(mrb, a), mrb_obj_value(c)); } else { - MRB_SET_VALUE_P(m, MRB_TT_PROC, 0); + MRB_SET_VALUE(m, MRB_TT_PROC, value.p, 0); mrb_define_method_vm(mrb, c, a, m); } } @@ -37,7 +37,7 @@ void abort(void); #define SET_NIL_VALUE(r) MRB_SET_VALUE(r, MRB_TT_FALSE, value.i, 0) #define SET_INT_VALUE(r,n) MRB_SET_VALUE(r, MRB_TT_FIXNUM, value.i, (n)) #define SET_SYM_VALUE(r,v) MRB_SET_VALUE(r, MRB_TT_SYMBOL, value.sym, (v)) -#define SET_OBJ_VALUE(r,v) MRB_SET_VALUE_P(r, (((struct RObject*)(v))->tt), (v)) +#define SET_OBJ_VALUE(r,v) MRB_SET_VALUE(r, (((struct RObject*)(v))->tt), value.p, (v)) #ifdef MRB_NAN_BOXING #define SET_FLT_VALUE(mrb,r,v) r.f = (v) #elif defined(MRB_WORD_BOXING) |
