summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-02 01:34:11 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-02 01:34:11 +0000
commit38b8afcf5a4abfc5d8319bcb30a239668eccfb9f (patch)
tree0a11d2d7fea812d7e81b9322f50d1ce40ae0fcef /string.c
parent86300419455029ed1e1aa7d344c7e070c1e99d8d (diff)
* string.c (rb_str_start_with, rb_str_end_with): raise an error if
an argument is not convertible to a String. [ruby-core:40623][Bug #5536] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/string.c b/string.c
index e16b4291d8..079891a04a 100644
--- a/string.c
+++ b/string.c
@@ -7197,8 +7197,8 @@ rb_str_start_with(int argc, VALUE *argv, VALUE str)
int i;
for (i=0; i<argc; i++) {
- VALUE tmp = rb_check_string_type(argv[i]);
- if (NIL_P(tmp)) continue;
+ VALUE tmp = argv[i];
+ StringValue(tmp);
rb_enc_check(str, tmp);
if (RSTRING_LEN(str) < RSTRING_LEN(tmp)) continue;
if (memcmp(RSTRING_PTR(str), RSTRING_PTR(tmp), RSTRING_LEN(tmp)) == 0)
@@ -7222,8 +7222,8 @@ rb_str_end_with(int argc, VALUE *argv, VALUE str)
rb_encoding *enc;
for (i=0; i<argc; i++) {
- VALUE tmp = rb_check_string_type(argv[i]);
- if (NIL_P(tmp)) continue;
+ VALUE tmp = argv[i];
+ StringValue(tmp);
enc = rb_enc_check(str, tmp);
if (RSTRING_LEN(str) < RSTRING_LEN(tmp)) continue;
p = RSTRING_PTR(str);