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 | 411216201eb3e8c79b9ae29f42b51b03b3e7b1d8 (patch) | |
tree | 324b1dbdf4149be943eb3cbff26ad7f377e53dc0 /file.c | |
parent | 81ba2325bd19cd99c79937cc53a6c19770f62b84 (diff) | |
download | ruby-411216201eb3e8c79b9ae29f42b51b03b3e7b1d8.tar.gz ruby-411216201eb3e8c79b9ae29f42b51b03b3e7b1d8.tar.xz ruby-411216201eb3e8c79b9ae29f42b51b03b3e7b1d8.zip |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@2784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -2024,26 +2024,28 @@ rb_stat_init(obj, fname) } static VALUE -rb_stat_become(obj, orig) - VALUE obj, orig; +rb_stat_become(copy, orig) + VALUE copy, orig; { struct stat *nst; + if (copy == orig) return orig; + rb_check_frozen(copy); /* need better argument type check */ - if (!rb_obj_is_instance_of(orig, rb_obj_class(obj))) { + if (!rb_obj_is_instance_of(orig, rb_obj_class(copy))) { rb_raise(rb_eTypeError, "wrong argument class"); } - if (DATA_PTR(obj)) { - free(DATA_PTR(obj)); - DATA_PTR(obj) = 0; + if (DATA_PTR(copy)) { + free(DATA_PTR(copy)); + DATA_PTR(copy) = 0; } if (DATA_PTR(orig)) { nst = ALLOC(struct stat); *nst = *(struct stat*)DATA_PTR(orig); - DATA_PTR(obj) = nst; + DATA_PTR(copy) = nst; } - return obj; + return copy; } static VALUE |