1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

variable.c: rb_class_ivar_set

* variable.c (rb_class_ivar_set): rename as class specific ivar
  setter, and st_table is no longer involved.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-10-30 03:07:06 +00:00
parent a96626e6da
commit 6f77d0a3aa
4 changed files with 11 additions and 7 deletions

View file

@ -1,3 +1,8 @@
Fri Oct 30 12:06:59 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* variable.c (rb_class_ivar_set): rename as class specific ivar
setter, and st_table is no longer involved.
Fri Oct 30 11:36:33 2015 Eric Wong <e@80x24.org> Fri Oct 30 11:36:33 2015 Eric Wong <e@80x24.org>
* variable.c (generic_ivar_remove): adjust type, set valp * variable.c (generic_ivar_remove): adjust type, set valp

View file

@ -426,7 +426,7 @@ rb_singleton_class_attached(VALUE klass, VALUE obj)
if (!RCLASS_IV_TBL(klass)) { if (!RCLASS_IV_TBL(klass)) {
RCLASS_IV_TBL(klass) = st_init_numtable(); RCLASS_IV_TBL(klass) = st_init_numtable();
} }
rb_st_insert_id_and_value(klass, id_attached, obj); rb_class_ivar_set(klass, id_attached, obj);
} }
} }

View file

@ -1317,8 +1317,7 @@ extern unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, si
void rb_gc_mark_global_tbl(void); void rb_gc_mark_global_tbl(void);
void rb_mark_generic_ivar(VALUE); void rb_mark_generic_ivar(VALUE);
VALUE rb_const_missing(VALUE klass, VALUE name); VALUE rb_const_missing(VALUE klass, VALUE name);
int rb_class_ivar_set(VALUE klass, ID vid, 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); st_table *rb_st_copy(VALUE obj, struct st_table *orig_tbl);
/* gc.c (export) */ /* gc.c (export) */

View file

@ -158,7 +158,7 @@ find_class_path(VALUE klass, ID preferred)
if (!RCLASS_IV_TBL(klass)) { if (!RCLASS_IV_TBL(klass)) {
RCLASS_IV_TBL(klass) = st_init_numtable(); RCLASS_IV_TBL(klass) = st_init_numtable();
} }
rb_st_insert_id_and_value(klass, (st_data_t)classpath, arg.path); rb_class_ivar_set(klass, (st_data_t)classpath, arg.path);
st_delete(RCLASS_IV_TBL(klass), &tmp, 0); st_delete(RCLASS_IV_TBL(klass), &tmp, 0);
return arg.path; return arg.path;
@ -1412,7 +1412,7 @@ rb_ivar_set(VALUE obj, ID id, VALUE val)
case T_CLASS: case T_CLASS:
case T_MODULE: case T_MODULE:
if (!RCLASS_IV_TBL(obj)) RCLASS_IV_TBL(obj) = st_init_numtable(); if (!RCLASS_IV_TBL(obj)) RCLASS_IV_TBL(obj) = st_init_numtable();
rb_st_insert_id_and_value(obj, (st_data_t)id, val); rb_class_ivar_set(obj, (st_data_t)id, val);
break; break;
default: default:
generic_ivar_set(obj, id, val); generic_ivar_set(obj, id, val);
@ -2803,7 +2803,7 @@ rb_cvar_set(VALUE klass, ID id, VALUE val)
RCLASS_IV_TBL(target) = st_init_numtable(); RCLASS_IV_TBL(target) = st_init_numtable();
} }
rb_st_insert_id_and_value(target, (st_data_t)id, (st_data_t)val); rb_class_ivar_set(target, (st_data_t)id, (st_data_t)val);
} }
VALUE VALUE
@ -3032,7 +3032,7 @@ rb_iv_set(VALUE obj, const char *name, VALUE val)
/* tbl = xx(obj); tbl[key] = value; */ /* tbl = xx(obj); tbl[key] = value; */
int int
rb_st_insert_id_and_value(VALUE obj, ID key, VALUE value) rb_class_ivar_set(VALUE obj, ID key, VALUE value)
{ {
st_table *tbl = RCLASS_IV_TBL(obj); st_table *tbl = RCLASS_IV_TBL(obj);
int result = st_insert(tbl, (st_data_t)key, (st_data_t)value); int result = st_insert(tbl, (st_data_t)key, (st_data_t)value);