ruby-changes:40293
From: normal <ko1@a...>
Date: Fri, 30 Oct 2015 10:40:44 +0900 (JST)
Subject: [ruby-changes:40293] normal:r52374 (trunk): variable.c (rb_st_insert_id_and_value): reduce args
normal 2015-10-30 10:40:28 +0900 (Fri, 30 Oct 2015) New Revision: 52374 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52374 Log: variable.c (rb_st_insert_id_and_value): reduce args Minor simplification; this will hopefully make future patches for switching to id_table easier-to-review. * internal.h (rb_st_insert_id_and_value): update prototype * variable.c (rb_st_insert_id_and_value): reduce args (find_class_path): adjust call for less args (rb_ivar_set): ditto (rb_cvar_set): ditto * class.c (rb_singleton_class_attached): ditto Modified files: trunk/ChangeLog trunk/class.c trunk/internal.h trunk/variable.c Index: ChangeLog =================================================================== --- ChangeLog (revision 52373) +++ ChangeLog (revision 52374) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Oct 30 10:37:56 2015 Eric Wong <e@8...> + + * internal.h (rb_st_insert_id_and_value): update prototype + * variable.c (rb_st_insert_id_and_value): reduce args + (find_class_path): adjust call for less args + (rb_ivar_set): ditto + (rb_cvar_set): ditto + * class.c (rb_singleton_class_attached): ditto + Fri Oct 30 09:57:22 2015 SHIBATA Hiroshi <hsbt@r...> * gems/bundled_gems: update latest gems. Index: variable.c =================================================================== --- variable.c (revision 52373) +++ variable.c (revision 52374) @@ -158,8 +158,7 @@ find_class_path(VALUE klass, ID preferre https://github.com/ruby/ruby/blob/trunk/variable.c#L158 if (!RCLASS_IV_TBL(klass)) { RCLASS_IV_TBL(klass) = st_init_numtable(); } - rb_st_insert_id_and_value(klass, RCLASS_IV_TBL(klass), - (st_data_t)classpath, arg.path); + rb_st_insert_id_and_value(klass, (st_data_t)classpath, arg.path); st_delete(RCLASS_IV_TBL(klass), &tmp, 0); return arg.path; @@ -1412,7 +1411,7 @@ rb_ivar_set(VALUE obj, ID id, VALUE val) https://github.com/ruby/ruby/blob/trunk/variable.c#L1411 case T_CLASS: case T_MODULE: if (!RCLASS_IV_TBL(obj)) RCLASS_IV_TBL(obj) = st_init_numtable(); - rb_st_insert_id_and_value(obj, RCLASS_IV_TBL(obj), (st_data_t)id, val); + rb_st_insert_id_and_value(obj, (st_data_t)id, val); break; default: generic_ivar_set(obj, id, val); @@ -2804,8 +2803,7 @@ rb_cvar_set(VALUE klass, ID id, VALUE va https://github.com/ruby/ruby/blob/trunk/variable.c#L2803 RCLASS_IV_TBL(target) = st_init_numtable(); } - rb_st_insert_id_and_value(target, RCLASS_IV_TBL(target), - (st_data_t)id, (st_data_t)val); + rb_st_insert_id_and_value(target, (st_data_t)id, (st_data_t)val); } VALUE @@ -3034,8 +3032,9 @@ rb_iv_set(VALUE obj, const char *name, V https://github.com/ruby/ruby/blob/trunk/variable.c#L3032 /* tbl = xx(obj); tbl[key] = value; */ int -rb_st_insert_id_and_value(VALUE obj, st_table *tbl, ID key, VALUE value) +rb_st_insert_id_and_value(VALUE obj, ID key, VALUE value) { + st_table *tbl = RCLASS_IV_TBL(obj); int result = st_insert(tbl, (st_data_t)key, (st_data_t)value); RB_OBJ_WRITTEN(obj, Qundef, value); return result; Index: class.c =================================================================== --- class.c (revision 52373) +++ class.c (revision 52374) @@ -426,7 +426,7 @@ rb_singleton_class_attached(VALUE klass, https://github.com/ruby/ruby/blob/trunk/class.c#L426 if (!RCLASS_IV_TBL(klass)) { RCLASS_IV_TBL(klass) = st_init_numtable(); } - rb_st_insert_id_and_value(klass, RCLASS_IV_TBL(klass), id_attached, obj); + rb_st_insert_id_and_value(klass, id_attached, obj); } } Index: internal.h =================================================================== --- internal.h (revision 52373) +++ internal.h (revision 52374) @@ -1318,7 +1318,7 @@ void rb_gc_mark_global_tbl(void); https://github.com/ruby/ruby/blob/trunk/internal.h#L1318 void rb_mark_generic_ivar(VALUE); VALUE rb_const_missing(VALUE klass, VALUE name); -int rb_st_insert_id_and_value(VALUE obj, st_table *tbl, ID key, VALUE value); +int rb_st_insert_id_and_value(VALUE obj, ID key, VALUE value); st_table *rb_st_copy(VALUE obj, struct st_table *orig_tbl); /* gc.c (export) */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/