ruby-changes:33546
From: nobu <ko1@a...>
Date: Fri, 18 Apr 2014 21:42:09 +0900 (JST)
Subject: [ruby-changes:33546] nobu:r45627 (trunk): README.EXT: about string termination
nobu 2014-04-18 21:42:04 +0900 (Fri, 18 Apr 2014) New Revision: 45627 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45627 Log: README.EXT: about string termination * README.EXT (Appendix B): add RSTRING_PTR and RSTRING_LEN. and NULL-termination by StringValueCStr. Modified files: trunk/README.EXT trunk/README.EXT.ja Index: README.EXT =================================================================== --- README.EXT (revision 45626) +++ README.EXT (revision 45627) @@ -1081,6 +1081,15 @@ rb_float_new(f) :: https://github.com/ruby/ruby/blob/trunk/README.EXT#L1081 double -> Float +RSTRING_LEN(str) :: + + String -> length of String data in bytes + +RSTRING_PTR(str) :: + + String -> pointer to String data + Note that the result pointer may not be NULL-terminated + StringValue(value) :: Object with #to_str -> String @@ -1092,6 +1101,7 @@ StringValuePtr(value) :: https://github.com/ruby/ruby/blob/trunk/README.EXT#L1101 StringValueCStr(value) :: Object with #to_str -> pointer to String data without NULL bytes + It is guaranteed that the result data is NULL-terminated rb_str_new2(s) :: Index: README.EXT.ja =================================================================== --- README.EXT.ja (revision 45626) +++ README.EXT.ja (revision 45627) @@ -1119,6 +1119,8 @@ Data_Get_Struct(data, type, sval) :: https://github.com/ruby/ruby/blob/trunk/README.EXT.ja#L1119 rb_integer_pack(value, words, numwords, wordsize, nails, flags), rb_integer_unpack(words, numwords, wordsize, nails, flags) NUM2DBL(value) rb_float_new(f) + RSTRING_LEN(str) + RSTRING_PTR(str) StringValue(value) StringValuePtr(value) StringValueCStr(value) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/