ruby-changes:30564
From: akr <ko1@a...>
Date: Wed, 21 Aug 2013 21:05:34 +0900 (JST)
Subject: [ruby-changes:30564] akr:r42643 (trunk): * process.c (rb_proc_times): Use RB_GC_GUARD to guard objects from GC.
akr 2013-08-21 21:05:29 +0900 (Wed, 21 Aug 2013) New Revision: 42643 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42643 Log: * process.c (rb_proc_times): Use RB_GC_GUARD to guard objects from GC. Modified files: trunk/ChangeLog trunk/process.c Index: ChangeLog =================================================================== --- ChangeLog (revision 42642) +++ ChangeLog (revision 42643) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Aug 21 21:02:37 2013 Tanaka Akira <akr@f...> + + * process.c (rb_proc_times): Use RB_GC_GUARD to guard objects from GC. + Wed Aug 21 20:33:01 2013 Tanaka Akira <akr@f...> * process.c (get_clk_tck): Extracted from rb_proc_times. Index: process.c =================================================================== --- process.c (revision 42642) +++ process.c (revision 42643) @@ -6641,14 +6641,19 @@ rb_proc_times(VALUE obj) https://github.com/ruby/ruby/blob/trunk/process.c#L6641 { const double hertz = get_clk_tck(); struct tms buf; - volatile VALUE utime, stime, cutime, sctime; + VALUE utime, stime, cutime, cstime, ret; times(&buf); - return rb_struct_new(rb_cProcessTms, - utime = DBL2NUM(buf.tms_utime / hertz), - stime = DBL2NUM(buf.tms_stime / hertz), - cutime = DBL2NUM(buf.tms_cutime / hertz), - sctime = DBL2NUM(buf.tms_cstime / hertz)); + utime = DBL2NUM(buf.tms_utime / hertz); + stime = DBL2NUM(buf.tms_stime / hertz); + cutime = DBL2NUM(buf.tms_cutime / hertz); + cstime = DBL2NUM(buf.tms_cstime / hertz); + ret = rb_struct_new(rb_cProcessTms, utime, stime, cutime, cstime); + RB_GC_GUARD(utime); + RB_GC_GUARD(stime); + RB_GC_GUARD(cutime); + RB_GC_GUARD(cstime); + return ret; } #else #define rb_proc_times rb_f_notimplement -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/