Skip to content


YARD doc for mrb_str_to_cstr.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsahara committed Nov 24, 2015
1 parent 625a3fe commit 90b7ec8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion include/mruby/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,19 @@ MRB_API mrb_value mrb_str_append(mrb_state *mrb, mrb_value str, mrb_value str2);
MRB_API int mrb_str_cmp(mrb_state *mrb, mrb_value str1, mrb_value str2);

* Returns a C string from a Ruby string.
* Returns a newly allocated C string from a Ruby string.
* This is an utility function to pass a Ruby string to C library functions.
* - Returned string does not contain any NUL characters (but terminator).
* - It raises an ArgumentError exception if Ruby string contains
* NUL characters.
* - Retured string will be freed automatically on next GC.
* - Caller can modify returned string without affecting Ruby string
* (e.g. it can be used for mkstemp(3)).
* @param [mrb_state *] mrb The current mruby state.
* @param [mrb_value] str Ruby string. Must be an instance of String.
* @return [char *] A newly allocated C string.
MRB_API char *mrb_str_to_cstr(mrb_state *mrb, mrb_value str);

Expand Down

0 comments on commit 90b7ec8

Please sign in to comment.