Commit 1001be2e authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #2852 from jbreeden/mrb_string_value_cstr_patch

Mrb string value cstr patch
parents 0b720ffa 9ad63255
......@@ -1985,7 +1985,8 @@ bad:
MRB_API const char*
mrb_string_value_cstr(mrb_state *mrb, mrb_value *ptr)
{
struct RString *ps = mrb_str_ptr(*ptr);
mrb_value str = mrb_str_to_str(mrb, *ptr);
struct RString *ps = mrb_str_ptr(str);
mrb_int len = mrb_str_strlen(mrb, ps);
char *p = RSTR_PTR(ps);
......@@ -2002,12 +2003,12 @@ mrb_str_to_inum(mrb_state *mrb, mrb_value str, mrb_int base, mrb_bool badcheck)
const char *s;
mrb_int len;
str = mrb_str_to_str(mrb, str);
if (badcheck) {
/* Raises if the string contains a null character (the badcheck) */
s = mrb_string_value_cstr(mrb, &str);
}
else {
s = RSTRING_PTR(str);
s = mrb_string_value_ptr(mrb, str);
}
if (s) {
len = RSTRING_LEN(str);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment