diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-04-09 05:52:44 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-04-09 05:52:44 +0000 |
commit | 56685525ddc132d4c6dbc3b909cb5acc9e8ced7c (patch) | |
tree | e6c0828178daf36c99efa008220fed62a803bf28 /file.c | |
parent | ab9e8e91ef61f32a6a8b0715bb6c573520c7f3d5 (diff) |
* file.c (Init_File): should redifine "new" class method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 23 |
1 files changed, 19 insertions, 4 deletions
@@ -335,7 +335,7 @@ rb_file_s_stat(klass, fname) if (rb_sys_stat(RSTRING(fname)->ptr, &st) == -1) { rb_sys_fail(RSTRING(fname)->ptr); } - return stat_new_0(klass, &st); + return stat_new(&st); } static VALUE @@ -1733,10 +1733,24 @@ static VALUE rb_stat_s_new(klass, fname) VALUE klass, fname; { - VALUE stat = rb_file_s_stat(klass, fname); + VALUE s; + struct stat st; - rb_obj_call_init(stat, 1, &fname); - return stat; + Check_SafeStr(fname); + if (rb_sys_stat(RSTRING(fname)->ptr, &st) == -1) { + rb_sys_fail(RSTRING(fname)->ptr); + } + s = stat_new_0(klass, &st); + rb_obj_call_init(s, 1, &fname); + return s; +} + +static VALUE +rb_stat_init(klass, fname) + VALUE klass, fname; +{ + /* do nothing */ + return Qnil; } static VALUE @@ -2283,6 +2297,7 @@ Init_File() rb_cStat = rb_define_class_under(rb_cFile, "Stat", rb_cObject); rb_define_singleton_method(rb_cStat, "new", rb_stat_s_new, 1); + rb_define_method(rb_cStat, "initialize", rb_stat_init, 1); rb_include_module(rb_cStat, rb_mComparable); |