summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-19 04:54:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-19 04:54:23 +0000
commit88249ada7542b97b3868853fdadfc0b4a5a739cf (patch)
treeaabc6c4132f6bd270df45686e22f6d3714cf3a27 /proc.c
parent172c5faba4de4d9acd8c1050e10242ee84bee694 (diff)
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
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/proc.c b/proc.c
index 8d177fa..530f3e8 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);
}
}