diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-08-10 08:47:18 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-08-10 08:47:18 +0000 |
commit | b0faee9b9cd5a747e226a2c64f33588b2b8f4e6c (patch) | |
tree | e3dcd4c31ffa63ad1e8a0bf4a88c63162002c101 /variable.c | |
parent | 3f8dd52fe04789d5c001dc5566decf2679b58e90 (diff) |
clone
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/variable.c b/variable.c index c8ad22f4b1..23ae945870 100644 --- a/variable.c +++ b/variable.c @@ -717,11 +717,9 @@ generic_ivar_set(obj, id, val) VALUE val; { st_table *tbl; - int special = Qfalse; if (rb_special_const_p(obj)) { special_generic_ivar = 1; - special = Qtrue; } if (!generic_iv_tbl) { generic_iv_tbl = st_init_numtable(); @@ -771,27 +769,28 @@ generic_ivar_remove(obj, id) return val; } -static int -givar_mark_i(key, value) - ID key; - VALUE value; -{ - rb_gc_mark(value); - return ST_CONTINUE; -} - void rb_mark_generic_ivar(obj) VALUE obj; { st_table *tbl; + if (!generic_iv_tbl) return; if (st_lookup(generic_iv_tbl, obj, &tbl)) { rb_mark_tbl(tbl); } } static int +givar_mark_i(key, value) + ID key; + VALUE value; +{ + rb_gc_mark(value); + return ST_CONTINUE; +} + +static int givar_i(obj, tbl) VALUE obj; st_table *tbl; @@ -805,8 +804,8 @@ givar_i(obj, tbl) void rb_mark_generic_ivar_tbl() { - if (special_generic_ivar == 0) return; if (!generic_iv_tbl) return; + if (special_generic_ivar == 0) return; st_foreach(generic_iv_tbl, givar_i, 0); } @@ -820,6 +819,18 @@ rb_free_generic_ivar(obj) st_free_table(tbl); } +void +rb_clone_generic_ivar(clone, obj) + VALUE clone, obj; +{ + st_table *tbl; + + if (!generic_iv_tbl) return; + if (st_lookup(generic_iv_tbl, obj, &tbl)) { + st_add_direct(generic_iv_tbl, clone, st_copy(tbl)); + } +} + VALUE rb_ivar_get(obj, id) VALUE obj; |