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

* string.c (rb_usascii_str_new): use rb_str_new.

* string.c (rb_enc_str_new): ditto.

* string.c (rb_usascii_str_new2): use rb_str_new2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-05-20 22:48:49 +00:00
parent fe8bb86125
commit 102f94455c
2 changed files with 13 additions and 8 deletions

View file

@ -1,3 +1,11 @@
Wed May 21 07:42:28 2008 NARUSE, Yui <naruse@ruby-lang.org>
* string.c (rb_usascii_str_new): use rb_str_new.
* string.c (rb_enc_str_new): ditto.
* string.c (rb_usascii_str_new2): use rb_str_new2.
Wed May 21 07:22:01 2008 NARUSE, Yui <naruse@ruby-lang.org>
* encoding.c, include/ruby/encoding.h

View file

@ -385,8 +385,7 @@ rb_str_new(const char *ptr, long len)
VALUE
rb_usascii_str_new(const char *ptr, long len)
{
VALUE str = str_new(rb_cString, ptr, len);
VALUE str = rb_str_new(ptr, len);
ENCODING_CODERANGE_SET(str, rb_usascii_encindex(), ENC_CODERANGE_7BIT);
return str;
}
@ -394,8 +393,7 @@ rb_usascii_str_new(const char *ptr, long len)
VALUE
rb_enc_str_new(const char *ptr, long len, rb_encoding *enc)
{
VALUE str = str_new(rb_cString, ptr, len);
VALUE str = rb_str_new(ptr, len);
rb_enc_associate(str, enc);
return str;
}
@ -412,10 +410,9 @@ rb_str_new2(const char *ptr)
VALUE
rb_usascii_str_new2(const char *ptr)
{
if (!ptr) {
rb_raise(rb_eArgError, "NULL pointer given");
}
return rb_usascii_str_new(ptr, strlen(ptr));
VALUE str = rb_str_new2(ptr);
ENCODING_CODERANGE_SET(str, rb_usascii_encindex(), ENC_CODERANGE_7BIT);
return str;
}
VALUE