diff --git a/ChangeLog b/ChangeLog index 2a564b23e0..2bc32fda98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Aug 5 20:13:49 2010 Nobuyoshi Nakada + + * 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 * string.c (rb_str_set_len): bail out when buffer overflowed diff --git a/README.EXT b/README.EXT index 72dba58c5d..ac0d7cc98d 100644 --- a/README.EXT +++ b/README.EXT @@ -223,6 +223,23 @@ listed below: 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 rb_ary_new() diff --git a/README.EXT.ja b/README.EXT.ja index dae0d24b43..9d70602740 100644 --- a/README.EXT.ja +++ b/README.EXT.ja @@ -250,6 +250,22 @@ 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の容量を越えてい + てはならない. + 配列に対する関数