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

ruby-changes:38887

From: nobu <ko1@a...>
Date: Fri, 19 Jun 2015 13:54:50 +0900 (JST)
Subject: [ruby-changes:38887] nobu:r50968 (trunk): proc.c: extract same messages

nobu	2015-06-19 13:54:23 +0900 (Fri, 19 Jun 2015)

  New Revision: 50968

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

  Log:
    proc.c: extract same messages
    
    * proc.c (proc_new): extract same warning and error messages.

  Modified files:
    trunk/proc.c
Index: proc.c
===================================================================
--- proc.c	(revision 50967)
+++ proc.c	(revision 50968)
@@ -564,6 +564,8 @@ bind_receiver(VALUE bindval) https://github.com/ruby/ruby/blob/trunk/proc.c#L564
     return env->block.self;
 }
 
+static const char proc_without_block[] = "tried to create Proc object without a block";
+
 static VALUE
 proc_new(VALUE klass, int8_t is_lambda)
 {
@@ -577,12 +579,11 @@ proc_new(VALUE klass, int8_t is_lambda) https://github.com/ruby/ruby/blob/trunk/proc.c#L579
 
 	if ((block = rb_vm_control_frame_block_ptr(cfp)) != 0) {
 	    if (is_lambda) {
-		rb_warn("tried to create Proc object without a block");
+		rb_warn(proc_without_block);
 	    }
 	}
 	else {
-	    rb_raise(rb_eArgError,
-		     "tried to create Proc object without a block");
+	    rb_raise(rb_eArgError, proc_without_block);
 	}
     }
 

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

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