[前][次][番号順一覧][スレッド一覧]

ruby-changes:38930

From: normal <ko1@a...>
Date: Wed, 24 Jun 2015 16:18:33 +0900 (JST)
Subject: [ruby-changes:38930] normal:r51011 (trunk): string.c (rb_str_justify): use RB_GC_GUARD

normal	2015-06-24 16:17:44 +0900 (Wed, 24 Jun 2015)

  New Revision: 51011

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51011

  Log:
    string.c (rb_str_justify): use RB_GC_GUARD
    
    See doc/extension.rdoc for justification using RB_GC_GUARD instead
    of volatile.

  Modified files:
    trunk/ChangeLog
    trunk/string.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51010)
+++ ChangeLog	(revision 51011)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jun 24 16:05:42 2015  Eric Wong  <e@8...>
+
+	* string.c (rb_str_justify): use RB_GC_GUARD
+
 Wed Jun 24 14:25:17 2015  Koichi Sasada  <ko1@a...>
 
 	* gc.c (gc_mark_ptr): add a check code for #11244.
Index: string.c
===================================================================
--- string.c	(revision 51010)
+++ string.c	(revision 51011)
@@ -7908,7 +7908,7 @@ rb_str_justify(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/string.c#L7908
     char *p;
     const char *f = " ";
     long n, size, llen, rlen, llen2 = 0, rlen2 = 0;
-    volatile VALUE pad;
+    VALUE pad;
     int singlebyte = 1, cr;
 
     rb_scan_args(argc, argv, "11", &w, &pad);
@@ -7985,6 +7985,8 @@ rb_str_justify(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/string.c#L7985
 	cr = ENC_CODERANGE_AND(cr, ENC_CODERANGE(pad));
     if (cr != ENC_CODERANGE_BROKEN)
 	ENC_CODERANGE_SET(res, cr);
+
+    RB_GC_GUARD(pad);
     return res;
 }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]