Hi all,
The following snippet is a silly thing to do, but I
thought it might be worth mentioning. It segfaults on
1.8p5, but not 1.6.x:
a = [1,2,3,4]
h = {}
a.map{ |e| h[e] = a.shift }
Suse Linux 8.0, btw.
Regards,
Dan
···
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
K.Sasada
(K.Sasada)
2
[ Segfault with map operation on 1.8p5 ]
Thu, 31 Jul 2003 11:41:33 +0900
The following snippet is a silly thing to do, but I
thought it might be worth mentioning. It segfaults on
1.8p5, but not 1.6.x:
a = [1,2,3,4]
h = {}
a.map{ |e| h[e] = a.shift }
This problem is solved by following patch for ruby 1.8.0 p5.
regards,
···
–
// SASADA Koichi @ namikilab.tuat.ac.jp
//
// Thanks to unak 
— array.c.org Thu Jul 31 03:20:06 2003
+++ array.c Thu Jul 31 03:29:54 2003
@@ -1197,9 +1197,8 @@ rb_ary_collect(ary)
return rb_ary_new4(RARRAY(ary)->len, RARRAY(ary)->ptr);
}
- len = RARRAY(ary)->len;
collect = rb_ary_new2(len);
- for (i=0; i<len; i++) {
- for (i=0; i<RARRAY(ary)->len; i++) {
rb_ary_push(collect, rb_yield(RARRAY(ary)->ptr[i]));
}
return collect;
Hello,
In message “Re: Segfault with map operation on 1.8p5”
This problem is solved by following patch for ruby 1.8.0 p5.
Hmmm, this?
— array.c 25 Jul 2003 05:36:46 -0000 1.128
+++ array.c 31 Jul 2003 04:03:48 -0000
@@ -1192,3 +1192,3 @@ rb_ary_collect(ary)
{
- long i;
VALUE collect;
@@ -1199,5 +1199,4 @@ rb_ary_collect(ary)
- len = RARRAY(ary)->len;
- collect = rb_ary_new2(len);
- for (i=0; i<len; i++) {
- collect = rb_ary_new();
- for (i = 0; i < RARRAY(ary)->len; i++) {
rb_ary_push(collect, rb_yield(RARRAY(ary)->ptr[i]));
Regards,
···
U.Nakamura usa@osb.att.ne.jp