* README.EXT, README.EXT.ja (String functions): mention
rb_str_resize and rb_str_set_len. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b80ddbf461
commit
3a32ef53aa
@ -1,3 +1,8 @@
|
|||||||
|
Thu Aug 5 20:13:49 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* README.EXT, README.EXT.ja (String functions): mention
|
||||||
|
rb_str_resize and rb_str_set_len.
|
||||||
|
|
||||||
Thu Aug 5 19:59:55 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Aug 5 19:59:55 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (rb_str_set_len): bail out when buffer overflowed
|
* string.c (rb_str_set_len): bail out when buffer overflowed
|
||||||
|
17
README.EXT
17
README.EXT
@ -223,6 +223,23 @@ listed below:
|
|||||||
|
|
||||||
Creates a new Ruby string with encoding US-ASCII.
|
Creates a new Ruby string with encoding US-ASCII.
|
||||||
|
|
||||||
|
rb_str_resize(VALUE str, long len)
|
||||||
|
|
||||||
|
Resizes Ruby string to len bytes. If str is not modifiable, this
|
||||||
|
function raises an exception. The length of str must be set in
|
||||||
|
advance. If len is less than the old length the content beyond
|
||||||
|
len bytes is discarded, else if len is greater than the old length
|
||||||
|
the content beyond the old length bytes will not be preserved but
|
||||||
|
will be garbage. Note that RSTRING_PTR(str) may change by calling
|
||||||
|
this function.
|
||||||
|
|
||||||
|
rb_str_set_len(VALUE str, long len)
|
||||||
|
|
||||||
|
Sets the length of Ruby string. If str is not modifiable, this
|
||||||
|
function raises an exception. This function preserves the content
|
||||||
|
upto len bytes, regardless RSTRING_LEN(str). len must not exceed
|
||||||
|
the capacity of str.
|
||||||
|
|
||||||
Array functions
|
Array functions
|
||||||
|
|
||||||
rb_ary_new()
|
rb_ary_new()
|
||||||
|
@ -250,6 +250,22 @@ Ruby
|
|||||||
|
|
||||||
エンコーディングがUS-ASCIIのRubyの文字列を生成する.
|
エンコーディングがUS-ASCIIのRubyの文字列を生成する.
|
||||||
|
|
||||||
|
rb_str_resize(VALUE str, long len)
|
||||||
|
|
||||||
|
Rubyの文字列のサイズをlenバイトに変更する.strの長さは前
|
||||||
|
以てセットされていなければならない.lenが元の長さよりも短
|
||||||
|
い時は,lenバイトを越えた部分の内容は捨てられる.lenが元
|
||||||
|
の長さよりも長い時は,元の長さを越えた部分の内容は保存さ
|
||||||
|
れないでゴミになるだろう.この関数の呼び出しによって
|
||||||
|
RSTRING_PTR(str)が変更されるかもしれないことに注意.
|
||||||
|
|
||||||
|
rb_str_set_len(VALUE str, long len)
|
||||||
|
|
||||||
|
Rubyの文字列のサイズをlenバイトにセットする.strが変更可
|
||||||
|
能でなければ例外が発生する.RSTRING_LEN(str)とは無関係に,
|
||||||
|
lenバイトまでの内容は保存される.lenはstrの容量を越えてい
|
||||||
|
てはならない.
|
||||||
|
|
||||||
|
|
||||||
配列に対する関数
|
配列に対する関数
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user