ruby-changes:9021
From: yugui <ko1@a...>
Date: Fri, 5 Dec 2008 22:35:57 +0900 (JST)
Subject: [ruby-changes:9021] Ruby:r20557 (ruby_1_9_1): merges r20546 from trunk into ruby-1_9_1.
yugui 2008-12-05 22:34:55 +0900 (Fri, 05 Dec 2008) New Revision: 20557 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20557 Log: merges r20546 from trunk into ruby-1_9_1. * complex.c: inpsect should not depend on to_s. Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/complex.c Index: ruby_1_9_1/complex.c =================================================================== --- ruby_1_9_1/complex.c (revision 20556) +++ ruby_1_9_1/complex.c (revision 20557) @@ -910,7 +910,7 @@ } static VALUE -nucomp_to_s(VALUE self) +nucomp_format(VALUE self, VALUE (*func)(VALUE)) { VALUE s, impos; @@ -918,10 +918,10 @@ impos = f_tpositive_p(dat->imag); - s = f_to_s(dat->real); + s = (*func)(dat->real); rb_str_cat2(s, !impos ? "-" : "+"); - rb_str_concat(s, f_to_s(f_abs(dat->imag))); + rb_str_concat(s, (*func)(f_abs(dat->imag))); if (!rb_isdigit(RSTRING_PTR(s)[RSTRING_LEN(s) - 1])) rb_str_cat2(s, "*"); rb_str_cat2(s, "i"); @@ -930,12 +930,18 @@ } static VALUE +nucomp_to_s(VALUE self) +{ + return nucomp_format(self, f_to_s); +} + +static VALUE nucomp_inspect(VALUE self) { VALUE s; s = rb_str_new2("("); - rb_str_concat(s, nucomp_to_s(self)); + rb_str_concat(s, nucomp_format(self, f_inspect)); rb_str_cat2(s, ")"); return s; Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 20556) +++ ruby_1_9_1/ChangeLog (revision 20557) @@ -1,3 +1,7 @@ +Fri Dec 5 21:42:44 2008 Tadayoshi Funaba <tadf@d...> + + * complex.c: inpsect should not depend on to_s. + Fri Dec 5 12:38:48 2008 Nobuyoshi Nakada <nobu@r...> * compile.c (iseq_set_sequence): uses rb_compile_warning() for -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/