Permalink
Browse files

new API function mrb_string_value_len()

  • Loading branch information...
matz committed Dec 1, 2015
1 parent 0701236 commit 36fabe104b68ffe887b1e3fc9405ce734a6d5798
Showing with 9 additions and 1 deletion.
  1. +2 −1 include/mruby/string.h
  2. +7 −0 src/string.c
View
@@ -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.
View
@@ -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)
{

0 comments on commit 36fabe1

Please sign in to comment.