diff options
| -rw-r--r-- | include/mruby.h | 2 | ||||
| -rw-r--r-- | mrbgems/mruby-struct/src/struct.c | 8 | ||||
| -rw-r--r-- | src/etc.c | 7 |
3 files changed, 6 insertions, 11 deletions
diff --git a/include/mruby.h b/include/mruby.h index ee73defb9..5e3d78c1e 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -243,7 +243,7 @@ mrb_value mrb_run(mrb_state*, struct RProc*, mrb_value); void mrb_p(mrb_state*, mrb_value); mrb_int mrb_obj_id(mrb_value obj); -mrb_sym mrb_to_id(mrb_state *mrb, mrb_value name); +mrb_sym mrb_obj_to_sym(mrb_state *mrb, mrb_value name); int mrb_obj_eq(mrb_state*, mrb_value, mrb_value); int mrb_obj_equal(mrb_state*, mrb_value, mrb_value); diff --git a/mrbgems/mruby-struct/src/struct.c b/mrbgems/mruby-struct/src/struct.c index 18cd71618..a074f163d 100644 --- a/mrbgems/mruby-struct/src/struct.c +++ b/mrbgems/mruby-struct/src/struct.c @@ -247,7 +247,7 @@ make_struct(mrb_state *mrb, mrb_value name, mrb_value members, struct RClass * k else { /* old style: should we warn? */ name = mrb_str_to_str(mrb, name); - id = mrb_to_id(mrb, name); + id = mrb_obj_to_sym(mrb, name); if (!mrb_is_const_id(id)) { mrb_name_error(mrb, id, "identifier %S needs to be constant", name); } @@ -377,7 +377,7 @@ mrb_struct_s_def(mrb_state *mrb, mrb_value klass) rest = mrb_ary_new_from_values(mrb, argcnt, pargv); } for (i=0; i<RARRAY_LEN(rest); i++) { - id = mrb_to_id(mrb, RARRAY_PTR(rest)[i]); + id = mrb_obj_to_sym(mrb, RARRAY_PTR(rest)[i]); RARRAY_PTR(rest)[i] = mrb_symbol_value(id); } } @@ -573,7 +573,7 @@ mrb_struct_aref_n(mrb_state *mrb, mrb_value s, mrb_value idx) mrb_int i; if (mrb_string_p(idx) || mrb_symbol_p(idx)) { - return mrb_struct_aref_id(mrb, s, mrb_to_id(mrb, idx)); + return mrb_struct_aref_id(mrb, s, mrb_obj_to_sym(mrb, idx)); } i = mrb_fixnum(idx); @@ -655,7 +655,7 @@ mrb_struct_aset(mrb_state *mrb, mrb_value s) mrb_get_args(mrb, "oo", &idx, &val); if (mrb_string_p(idx) || mrb_symbol_p(idx)) { - return mrb_struct_aset_id(mrb, s, mrb_to_id(mrb, idx), val); + return mrb_struct_aset_id(mrb, s, mrb_obj_to_sym(mrb, idx), val); } i = mrb_fixnum(idx); @@ -85,13 +85,8 @@ mrb_exec_recursive(mrb_state *mrb, mrb_value (*func) (mrb_state *, mrb_value, mr return func(mrb, obj, *(mrb_value*)arg, 0); } -/* - * Calls func(obj, arg, recursive), where recursive is non-zero if the - * current method is called recursively on the ordered pair <obj, paired_obj> - */ - mrb_sym -mrb_to_id(mrb_state *mrb, mrb_value name) +mrb_obj_to_sym(mrb_state *mrb, mrb_value name) { mrb_value tmp; mrb_sym id; |
