summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-03 05:20:14 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-03 05:20:14 +0000
commit6f484e4930be69c58462dd11c97663e6c8488b8e (patch)
tree324b1dbdf4149be943eb3cbff26ad7f377e53dc0 /file.c
parent20254d4e133331e69e6aa7514e1e72ad7d14d496 (diff)
* 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 'file.c')
-rw-r--r--file.c18
1 files changed, 10 insertions, 8 deletions
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