From 6f484e4930be69c58462dd11c97663e6c8488b8e Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 3 Sep 2002 05:20:14 +0000 Subject: * 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 --- file.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index 3e53f70982..148ef04925 100644 --- a/file.c +++ b/file.c @@ -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 -- cgit v1.2.3