summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-12 14:47:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-12 14:47:23 +0000
commitd410639a6d422e0ae032f049ccfbbbb45b312d6f (patch)
tree7f967d0f5320dea31975c536b705cedc1db23db5 /variable.c
parent17c48bebf87828abeb5be91ed8ba0a2b72bc5479 (diff)
* compile.c (iseq_build_body), error.c (set_syserr, get_syserr),
(syserr_initialize), gc.c (define_final, rb_gc_copy_finalizer), (run_final), hash.c (rb_hash_aref, rb_hash_lookup2), (rb_hash_fetch_m, rb_hash_clear, rb_hash_aset, eql_i), iseq.c (iseq_load, iseq_data_to_ary), marshal.c (r_symlink), thread.c (rb_thread_local_aref), variable.c (generic_ivar_remove, ivar_get, rb_const_get_0), (rb_cvar_get), vm.c (rb_vm_check_redefinition_opt_method), vm_insnhelper.c (vm_get_ev_const), vm_method.c (remove_method), ext/iconv/iconv.c (map_charset): use st_data_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/variable.c b/variable.c
index 6c653ca1d4..0316a902ac 100644
--- a/variable.c
+++ b/variable.c
@@ -885,15 +885,16 @@ static int
generic_ivar_remove(VALUE obj, ID id, st_data_t *valp)
{
st_table *tbl;
- st_data_t data;
+ st_data_t data, key = (st_data_t)id;
int status;
if (!generic_iv_tbl) return 0;
if (!st_lookup(generic_iv_tbl, (st_data_t)obj, &data)) return 0;
tbl = (st_table *)data;
- status = st_delete(tbl, &id, valp);
+ status = st_delete(tbl, &key, valp);
if (tbl->num_entries == 0) {
- st_delete(generic_iv_tbl, &obj, &data);
+ key = (st_data_t)obj;
+ st_delete(generic_iv_tbl, &key, &data);
st_free_table((st_table *)data);
}
return status;
@@ -1006,8 +1007,8 @@ ivar_get(VALUE obj, ID id, int warn)
break;
case T_CLASS:
case T_MODULE:
- if (RCLASS_IV_TBL(obj) && st_lookup(RCLASS_IV_TBL(obj), (st_data_t)id, &val))
- return val;
+ if (RCLASS_IV_TBL(obj) && st_lookup(RCLASS_IV_TBL(obj), (st_data_t)id, &index))
+ return (VALUE)index;
break;
default:
if (FL_TEST(obj, FL_EXIVAR) || rb_special_const_p(obj))
@@ -1575,7 +1576,9 @@ rb_const_get_0(VALUE klass, ID id, int exclude, int recurse)
retry:
while (RTEST(tmp)) {
VALUE am = 0;
- while (RCLASS_IV_TBL(tmp) && st_lookup(RCLASS_IV_TBL(tmp), (st_data_t)id, &value)) {
+ st_data_t data;
+ while (RCLASS_IV_TBL(tmp) && st_lookup(RCLASS_IV_TBL(tmp), (st_data_t)id, &data)) {
+ value = (VALUE)data;
if (value == Qundef) {
if (am == tmp) break;
am = tmp;
@@ -1937,7 +1940,8 @@ rb_cvar_set(VALUE klass, ID id, VALUE val)
VALUE
rb_cvar_get(VALUE klass, ID id)
{
- VALUE value, tmp, front = 0, target = 0;
+ VALUE tmp, front = 0, target = 0;
+ st_data_t value;
tmp = klass;
CVAR_LOOKUP(&value, {if (!front) front = klass; target = klass;});
@@ -1957,7 +1961,7 @@ rb_cvar_get(VALUE klass, ID id)
st_delete(RCLASS_IV_TBL(front),&did,0);
}
}
- return value;
+ return (VALUE)value;
}
VALUE