new API function mrb_string_value_len()

parent 0701236d
......@@ -123,7 +123,8 @@ MRB_API mrb_value mrb_check_string_type(mrb_state *mrb, mrb_value str);
MRB_API mrb_value mrb_str_buf_new(mrb_state *mrb, size_t capa);
MRB_API const char *mrb_string_value_cstr(mrb_state *mrb, mrb_value *ptr);
MRB_API const char *mrb_string_value_ptr(mrb_state *mrb, mrb_value ptr);
MRB_API const char *mrb_string_value_ptr(mrb_state *mrb, mrb_value str);
MRB_API mrb_int mrb_string_value_len(mrb_state *mrb, mrb_value str);
/*
* Duplicates a string object.
......
......@@ -1013,6 +1013,13 @@ mrb_string_value_ptr(mrb_state *mrb, mrb_value ptr)
return RSTRING_PTR(str);
}
MRB_API mrb_int
mrb_string_value_len(mrb_state *mrb, mrb_value ptr)
{
mrb_value str = mrb_str_to_str(mrb, ptr);
return RSTRING_LEN(str);
}
void
mrb_noregexp(mrb_state *mrb, mrb_value self)
{
......
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