diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-09-03 05:20:14 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-09-03 05:20:14 +0000 |
commit | 6f484e4930be69c58462dd11c97663e6c8488b8e (patch) | |
tree | 324b1dbdf4149be943eb3cbff26ad7f377e53dc0 /time.c | |
parent | 20254d4e133331e69e6aa7514e1e72ad7d14d496 (diff) | |
download | ruby-6f484e4930be69c58462dd11c97663e6c8488b8e.tar.gz |
* variable.c (rb_copy_generic_ivar): remove old generic instance
variable table if it existes.
* class.c (rb_make_metaclass): metaclass of a metaclass is a
metaclass itself.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -793,12 +793,23 @@ time_hash(time) return LONG2FIX(hash); } +static void +time_modify(time) + VALUE time; +{ + rb_check_frozen(time); + if (!OBJ_TAINTED(time) && rb_safe_level() >= 4) + rb_raise(rb_eSecurityError, "Insecure: can't modify Time"); +} + static VALUE time_become(copy, time) VALUE copy, time; { struct time_object *tobj, *tcopy; + if (copy == time) return copy; + time_modify(copy); if (TYPE(time) != T_DATA || RDATA(time)->dfree != time_free) { rb_raise(rb_eTypeError, "wrong argument type"); } @@ -818,15 +829,6 @@ time_dup(time) return dup; } -static void -time_modify(time) - VALUE time; -{ - if (OBJ_FROZEN(time)) rb_error_frozen("Time"); - if (!OBJ_TAINTED(time) && rb_safe_level() >= 4) - rb_raise(rb_eSecurityError, "Insecure: can't modify Time"); -} - static VALUE time_localtime(time) VALUE time; |