From 6767cd760a8f5274e238fca4567071a78ac43968 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 19 Sep 2001 06:54:11 +0000 Subject: * string.c (rb_str_init): String.new() => "" * dir.c (dir_path): new method. * dir.c (dir_initialize): wrap DIR into struct, along with path information. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'string.c') diff --git a/string.c b/string.c index 00c139cb91..5dea1c7ab2 100644 --- a/string.c +++ b/string.c @@ -302,6 +302,21 @@ rb_str_s_new(argc, argv, klass) return str; } +static VALUE rb_str_replace _((VALUE, VALUE)); + +static VALUE +rb_str_init(argc, argv, str) + int argc; + VALUE *argv; + VALUE str; +{ + VALUE orig; + + if (rb_scan_args(argc, argv, "01", &orig) == 1) + rb_str_replace(str, orig); + return str; +} + static VALUE rb_str_length(str) VALUE str; @@ -2992,7 +3007,7 @@ Init_String() rb_include_module(rb_cString, rb_mComparable); rb_include_module(rb_cString, rb_mEnumerable); rb_define_singleton_method(rb_cString, "new", rb_str_s_new, -1); - rb_define_method(rb_cString, "initialize", rb_str_replace, 1); + rb_define_method(rb_cString, "initialize", rb_str_init, -1); rb_define_method(rb_cString, "clone", rb_str_clone, 0); rb_define_method(rb_cString, "dup", rb_str_dup, 0); rb_define_method(rb_cString, "<=>", rb_str_cmp_m, 1); -- cgit v1.2.3