summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-30 01:40:28 (GMT)
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-30 01:40:28 (GMT)
commita666e9b5f2b23ecc506b6646c56e426d5d5d01f2 (patch)
tree494765399e4ae0725c02c5ceabd62156fa7997ff /variable.c
parent57880d7e35e6d40e23d531a6917a97c99986a0c9 (diff)
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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/variable.c b/variable.c
index 1d270e2..42a628e 100644
--- a/variable.c
+++ b/variable.c
@@ -158,8 +158,7 @@ find_class_path(VALUE klass, ID preferred)
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)
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 val)
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, VALUE val)
/* 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;