1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

README.EXT: about string termination

* README.EXT (Appendix B): add RSTRING_PTR and RSTRING_LEN.
  and NULL-termination by StringValueCStr.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-04-18 12:42:04 +00:00
parent 6a8d00496a
commit 95013cd5c0
2 changed files with 12 additions and 0 deletions

View file

@ -1081,6 +1081,15 @@ rb_float_new(f) ::
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) ::
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) ::

View file

@ -1119,6 +1119,8 @@ Data_Get_Struct(data, type, sval) ::
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)