summaryrefslogtreecommitdiff
path: root/ext/-test-
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-27 04:09:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-27 04:09:04 +0000
commit7e091d24ce6e478ba92b4c1188be0a795e0fc151 (patch)
treef04164559fa641ba5061005e4094072d45e41489 /ext/-test-
parent45e23ec16e0b57745c7ab9fcb166b6511c797ef5 (diff)
cstr.c: nil iff terminated validly
* ext/-test-/string/cstr.c (bug_str_cstr_term_char): return nil only when terminated validly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/-test-')
-rw-r--r--ext/-test-/string/cstr.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/-test-/string/cstr.c b/ext/-test-/string/cstr.c
index 81edbb0..ba2e46b 100644
--- a/ext/-test-/string/cstr.c
+++ b/ext/-test-/string/cstr.c
@@ -36,8 +36,9 @@ bug_str_cstr_term_char(VALUE str)
}
else {
c = rb_enc_mbc_to_codepoint(s, s + len, enc);
+ if (!c) return Qnil;
}
- return c ? rb_enc_uint_chr((unsigned int)c, enc) : Qnil;
+ return rb_enc_uint_chr((unsigned int)c, enc);
}
static VALUE