From 88249ada7542b97b3868853fdadfc0b4a5a739cf Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 19 Jun 2015 04:54:23 +0000 Subject: proc.c: extract same messages * proc.c (proc_new): extract same warning and error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- proc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'proc.c') diff --git a/proc.c b/proc.c index 8d177fae9f..530f3e8454 100644 --- a/proc.c +++ b/proc.c @@ -564,6 +564,8 @@ bind_receiver(VALUE bindval) 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) 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); } } -- cgit v1.2.3