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

ruby-changes:43861

From: usa <ko1@a...>
Date: Tue, 16 Aug 2016 20:28:59 +0900 (JST)
Subject: [ruby-changes:43861] usa:r55934 (ruby_2_2): merge revision(s) 55115: [Backport #12411]

usa	2016-08-16 20:28:53 +0900 (Tue, 16 Aug 2016)

  New Revision: 55934

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

  Log:
    merge revision(s) 55115: [Backport #12411]
    
    * transcode.c (enc_arg, str_transcode_enc_args, econv_args):
      remove volatile, and add GC guards in callers.
      [ruby-core:75664] [Bug #12411]

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/transcode.c
    branches/ruby_2_2/version.h
Index: ruby_2_2/transcode.c
===================================================================
--- ruby_2_2/transcode.c	(revision 55933)
+++ ruby_2_2/transcode.c	(revision 55934)
@@ -2607,7 +2607,7 @@ rb_econv_open_opts(const char *source_en https://github.com/ruby/ruby/blob/trunk/ruby_2_2/transcode.c#L2607
 }
 
 static int
-enc_arg(volatile VALUE *arg, const char **name_p, rb_encoding **enc_p)
+enc_arg(VALUE *arg, const char **name_p, rb_encoding **enc_p)
 {
     rb_encoding *enc;
     const char *n;
@@ -2631,7 +2631,7 @@ enc_arg(volatile VALUE *arg, const char https://github.com/ruby/ruby/blob/trunk/ruby_2_2/transcode.c#L2631
 }
 
 static int
-str_transcode_enc_args(VALUE str, volatile VALUE *arg1, volatile VALUE *arg2,
+str_transcode_enc_args(VALUE str, VALUE *arg1, VALUE *arg2,
         const char **sname_p, rb_encoding **senc_p,
         const char **dname_p, rb_encoding **denc_p)
 {
@@ -2662,7 +2662,7 @@ str_transcode0(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/ruby_2_2/transcode.c#L2662
 {
     VALUE dest;
     VALUE str = *self;
-    volatile VALUE arg1, arg2;
+    VALUE arg1, arg2;
     long blen, slen;
     unsigned char *buf, *bp, *sp;
     const unsigned char *fromp;
@@ -2740,6 +2740,8 @@ str_transcode0(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/ruby_2_2/transcode.c#L2740
     /* set encoding */
     if (!denc) {
 	dencidx = rb_define_dummy_encoding(dname);
+	RB_GC_GUARD(arg1);
+	RB_GC_GUARD(arg2);
     }
     *self = dest;
 
@@ -2992,7 +2994,7 @@ econv_s_asciicompat_encoding(VALUE klass https://github.com/ruby/ruby/blob/trunk/ruby_2_2/transcode.c#L2994
 
 static void
 econv_args(int argc, VALUE *argv,
-    volatile VALUE *snamev_p, volatile VALUE *dnamev_p,
+    VALUE *snamev_p, VALUE *dnamev_p,
     const char **sname_p, const char **dname_p,
     rb_encoding **senc_p, rb_encoding **denc_p,
     int *ecflags_p,
@@ -3136,7 +3138,7 @@ search_convpath_i(const char *sname, con https://github.com/ruby/ruby/blob/trunk/ruby_2_2/transcode.c#L3138
 static VALUE
 econv_s_search_convpath(int argc, VALUE *argv, VALUE klass)
 {
-    volatile VALUE snamev, dnamev;
+    VALUE snamev, dnamev;
     const char *sname, *dname;
     rb_encoding *senc, *denc;
     int ecflags;
@@ -3151,8 +3153,12 @@ econv_s_search_convpath(int argc, VALUE https://github.com/ruby/ruby/blob/trunk/ruby_2_2/transcode.c#L3153
     if (NIL_P(convpath))
         rb_exc_raise(rb_econv_open_exc(sname, dname, ecflags));
 
-    if (decorate_convpath(convpath, ecflags) == -1)
-        rb_exc_raise(rb_econv_open_exc(sname, dname, ecflags));
+    if (decorate_convpath(convpath, ecflags) == -1) {
+	VALUE exc = rb_econv_open_exc(sname, dname, ecflags);
+	RB_GC_GUARD(snamev);
+	RB_GC_GUARD(dnamev);
+	rb_exc_raise(exc);
+    }
 
     return convpath;
 }
@@ -3208,7 +3214,7 @@ rb_econv_init_by_convpath(VALUE self, VA https://github.com/ruby/ruby/blob/trunk/ruby_2_2/transcode.c#L3214
     DATA_PTR(self) = ec;
 
     for (i = 0; i < RARRAY_LEN(convpath); i++) {
-        volatile VALUE snamev, dnamev;
+        VALUE snamev, dnamev;
         VALUE pair;
         elt = rb_ary_entry(convpath, i);
         if (!NIL_P(pair = rb_check_array_type(elt))) {
@@ -3225,8 +3231,12 @@ rb_econv_init_by_convpath(VALUE self, VA https://github.com/ruby/ruby/blob/trunk/ruby_2_2/transcode.c#L3231
         }
         if (DECORATOR_P(sname, dname)) {
             ret = rb_econv_add_converter(ec, sname, dname, ec->num_trans);
-            if (ret == -1)
-                rb_raise(rb_eArgError, "decoration failed: %s", dname);
+	    if (ret == -1) {
+		VALUE msg = rb_sprintf("decoration failed: %s", dname);
+		RB_GC_GUARD(snamev);
+		RB_GC_GUARD(dnamev);
+		rb_exc_raise(rb_exc_new_str(rb_eArgError, msg));
+	    }
         }
         else {
             int j = ec->num_trans;
@@ -3235,8 +3245,12 @@ rb_econv_init_by_convpath(VALUE self, VA https://github.com/ruby/ruby/blob/trunk/ruby_2_2/transcode.c#L3245
             arg.index = ec->num_trans;
             arg.ret = 0;
             ret = transcode_search_path(sname, dname, rb_econv_init_by_convpath_i, &arg);
-            if (ret == -1 || arg.ret == -1)
-                rb_raise(rb_eArgError, "adding conversion failed: %s to %s", sname, dname);
+	    if (ret == -1 || arg.ret == -1) {
+		VALUE msg = rb_sprintf("adding conversion failed: %s to %s", sname, dname);
+		RB_GC_GUARD(snamev);
+		RB_GC_GUARD(dnamev);
+                rb_exc_raise(rb_exc_new_str(rb_eArgError, msg));
+	    }
             if (first) {
                 first = 0;
                 *senc_p = senc;
@@ -3370,7 +3384,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ruby_2_2/transcode.c#L3384
 econv_init(int argc, VALUE *argv, VALUE self)
 {
     VALUE ecopts;
-    volatile VALUE snamev, dnamev;
+    VALUE snamev, dnamev;
     const char *sname, *dname;
     rb_encoding *senc, *denc;
     rb_econv_t *ec;
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 55933)
+++ ruby_2_2/version.h	(revision 55934)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.6"
 #define RUBY_RELEASE_DATE "2016-08-16"
-#define RUBY_PATCHLEVEL 360
+#define RUBY_PATCHLEVEL 361
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 8
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 55933)
+++ ruby_2_2/ChangeLog	(revision 55934)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Tue Aug 16 20:28:24 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* transcode.c (enc_arg, str_transcode_enc_args, econv_args):
+	  remove volatile, and add GC guards in callers.
+	  [ruby-core:75664] [Bug #12411]
+
 Tue Aug 16 14:58:50 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* common.mk (build-ext), ext/extmk.rb: use variable EXTENCS

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r55115


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

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