summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-29 22:15:23 (GMT)
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-29 22:15:23 (GMT)
commit3df94d7b5d7129d50443b77f869835b958423fd5 (patch)
tree0f4f4653b02cda56cc7f5b6b73850ca9d4a591a4 /re.c
parentc34e9f23aa2b6909e92623710e91cd99eaff2dc3 (diff)
* re.c (reg_operand): Simplify and reuse error handling [Bug #7539]
* test/ruby/test_regexp.rb: Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/re.c b/re.c
index 17612d4..4e57971 100644
--- a/re.c
+++ b/re.c
@@ -2667,12 +2667,7 @@ reg_operand(VALUE s, int check)
return rb_sym_to_s(s);
}
else {
- VALUE tmp = rb_check_string_type(s);
- if (check && NIL_P(tmp)) {
- rb_raise(rb_eTypeError, "can't convert %s to String",
- rb_obj_classname(s));
- }
- return tmp;
+ return (check ? rb_str_to_str : rb_check_string_type)(s);
}
}