mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* transcode.c (str_encode_bang): C99ism.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e5df8fd261
commit
a436212282
2 changed files with 9 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Fri Jul 31 13:15:27 2009 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* transcode.c (str_encode_bang): C99ism.
|
||||||
|
|
||||||
Fri Jul 31 11:48:03 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Jul 31 11:48:03 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* compile.c (iseq_compile_each): used more appropriate construct.
|
* compile.c (iseq_compile_each): used more appropriate construct.
|
||||||
|
|
|
@ -2644,12 +2644,15 @@ str_encode_associate(VALUE str, int encidx)
|
||||||
static VALUE
|
static VALUE
|
||||||
str_encode_bang(int argc, VALUE *argv, VALUE str)
|
str_encode_bang(int argc, VALUE *argv, VALUE str)
|
||||||
{
|
{
|
||||||
|
VALUE newstr;
|
||||||
|
int encidx;
|
||||||
|
|
||||||
if (OBJ_FROZEN(str)) { /* in future, may use str_frozen_check from string.c, but that's currently static */
|
if (OBJ_FROZEN(str)) { /* in future, may use str_frozen_check from string.c, but that's currently static */
|
||||||
rb_raise(rb_eRuntimeError, "string frozen");
|
rb_raise(rb_eRuntimeError, "string frozen");
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE newstr = str;
|
newstr = str;
|
||||||
int encidx = str_transcode(argc, argv, &newstr);
|
encidx = str_transcode(argc, argv, &newstr);
|
||||||
|
|
||||||
if (encidx < 0) return str;
|
if (encidx < 0) return str;
|
||||||
rb_str_shared_replace(str, newstr);
|
rb_str_shared_replace(str, newstr);
|
||||||
|
|
Loading…
Reference in a new issue