diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-21 12:05:29 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-21 12:05:29 +0000 |
commit | 31a092c6875ed271a8a6a1fa3ccfc5320096f95a (patch) | |
tree | 7a548beaebd35c11a40b96a5e342f28720f9f0cc /process.c | |
parent | 4b033d2692866f5d5944cd33b7dfa68d3dd4707a (diff) |
* process.c (rb_proc_times): Use RB_GC_GUARD to guard objects from GC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -6641,14 +6641,19 @@ rb_proc_times(VALUE obj) { 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 |