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

ruby-changes:40218

From: nobu <ko1@a...>
Date: Tue, 27 Oct 2015 16:41:22 +0900 (JST)
Subject: [ruby-changes:40218] nobu:r52299 (trunk): error.c: suppress warnings

nobu	2015-10-27 16:41:07 +0900 (Tue, 27 Oct 2015)

  New Revision: 52299

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

  Log:
    error.c: suppress warnings
    
    * error.c (rb_error_frozen_object): use rb_attr_get instead of
      rb_ivar_get to get rid of warnings for string objects created
      when frozen-string-literal-debug is disabled.

  Modified files:
    trunk/ChangeLog
    trunk/error.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52298)
+++ ChangeLog	(revision 52299)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Oct 27 16:41:05 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* error.c (rb_error_frozen_object): use rb_attr_get instead of
+	  rb_ivar_get to get rid of warnings for string objects created
+	  when frozen-string-literal-debug is disabled.
+
 Tue Oct 27 16:18:12 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/logger.rb (Logger::Period#previous_period_end): as weekly
Index: error.c
===================================================================
--- error.c	(revision 52298)
+++ error.c	(revision 52299)
@@ -2227,8 +2227,12 @@ void https://github.com/ruby/ruby/blob/trunk/error.c#L2227
 rb_error_frozen_object(VALUE frozen_obj)
 {
     VALUE path, line;
-    if ((path = rb_iv_get(frozen_obj, "__object_created_path__")) != Qnil &&
-	(line = rb_iv_get(frozen_obj, "__object_created_line__")) != Qnil) {
+    ID created_path, created_line;
+
+    CONST_ID(created_path, "__object_created_path__");
+    CONST_ID(created_line, "__object_created_line__");
+    if (!NIL_P(path = rb_attr_get(frozen_obj, created_path)) &&
+	!NIL_P(line = rb_attr_get(frozen_obj, created_line))) {
 	rb_raise(rb_eRuntimeError, "can't modify frozen %"PRIsVALUE", created at %"PRIsVALUE":%"PRIsVALUE,
 		 CLASS_OF(frozen_obj), path, line);
     }

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

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