diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-05 11:14:05 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-05 11:14:05 +0000 |
commit | 3a32ef53aaab15199e59c643630726b041c9fa88 (patch) | |
tree | 497cd16ea9db5b867ed794e06aff1f80ad5fb55b | |
parent | b80ddbf461a9a215513d6bbd78bab7185a927a31 (diff) |
* 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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | README.EXT | 17 | ||||
-rw-r--r-- | README.EXT.ja | 16 |
3 files changed, 38 insertions, 0 deletions
@@ -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> * 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の容量を越えてい + てはならない. + 配列に対する関数 |