[#20036] Re: Roundoff problem with Float and Marshal — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

16 messages 2003/04/18
[#20045] Re: Roundoff problem with Float and Marshal — nobu.nakada@... 2003/04/20

なかだです。

[#20063] Re: Roundoff problem with Float and Marshal — matz@... (Yukihiro Matsumoto) 2003/04/22

まつもと ゆきひろです

[#20097] jcode.rb — akira yamada / やまだあきら <akira@...>

25 messages 2003/04/26
[#20098] Re: jcode.rb — matz@... (Yukihiro Matsumoto) 2003/04/27

まつもと ゆきひろです

[#20105] Re: jcode.rb — WATANABE Hirofumi <eban@...> 2003/04/28

わたなべです。

[#20108] Re: jcode.rb — matz@... (Yukihiro Matsumoto) 2003/04/28

まつもと ゆきひろです

[ruby-dev:19980] ""*n

From: Tadayoshi Funaba <tadf@...5.so-net.ne.jp>
Date: 2003-04-09 15:56:16 UTC
List: ruby-dev #19980
rb_str_times ですけど、こうしても構わないですか?


Index: string.c
===================================================================
RCS file: /src/ruby/string.c,v
retrieving revision 1.149
diff -u -u -9 -r1.149 string.c
--- string.c	26 Mar 2003 18:26:45 -0000	1.149
+++ string.c	9 Apr 2003 15:48:34 -0000
@@ -334,19 +334,19 @@
 VALUE
 rb_str_times(str, times)
     VALUE str;
     VALUE times;
 {
     VALUE str2;
     long i, len;
 
     len = NUM2LONG(times);
-    if (len == 0) return rb_str_new5(str,0,0);
+    if (RSTRING(str)->len == 0 || len == 0) return rb_str_new5(str,0,0);
     if (len < 0) {
 	rb_raise(rb_eArgError, "negative argument");
     }
     if (LONG_MAX/len <  RSTRING(str)->len) {
 	rb_raise(rb_eArgError, "argument too big");
     }
 
     str2 = rb_str_new5(str,0, RSTRING(str)->len*len);
     for (i=0; i<len; i++) {


In This Thread

Prev Next