mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
* string.c (str_independent): no independent string points null_str.
[ruby-core:20082] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@20354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
264e35b5e0
commit
d5a75a3550
2 changed files with 8 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Tue Nov 25 16:09:36 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (str_independent): no independent string points null_str.
|
||||||
|
[ruby-core:20082]
|
||||||
|
|
||||||
Tue Nov 25 03:37:42 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
Tue Nov 25 03:37:42 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
* ext/tk/lib/tkextlib/blt/tabset.rb,
|
* ext/tk/lib/tkextlib/blt/tabset.rb,
|
||||||
|
|
4
string.c
4
string.c
|
@ -471,6 +471,8 @@ rb_str_format_m(str, arg)
|
||||||
return rb_str_format(1, &arg, str);
|
return rb_str_format(1, &arg, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char null_str[] = "";
|
||||||
|
|
||||||
static int
|
static int
|
||||||
str_independent(str)
|
str_independent(str)
|
||||||
VALUE str;
|
VALUE str;
|
||||||
|
@ -481,6 +483,7 @@ str_independent(str)
|
||||||
if (OBJ_FROZEN(str)) rb_error_frozen("string");
|
if (OBJ_FROZEN(str)) rb_error_frozen("string");
|
||||||
if (!OBJ_TAINTED(str) && rb_safe_level() >= 4)
|
if (!OBJ_TAINTED(str) && rb_safe_level() >= 4)
|
||||||
rb_raise(rb_eSecurityError, "Insecure: can't modify string");
|
rb_raise(rb_eSecurityError, "Insecure: can't modify string");
|
||||||
|
if (RSTRING(str)->ptr == null_str) return 0;
|
||||||
if (!FL_TEST(str, ELTS_SHARED)) return 1;
|
if (!FL_TEST(str, ELTS_SHARED)) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -539,7 +542,6 @@ rb_str_associated(str)
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char null_str[] = "";
|
|
||||||
#define make_null_str(s) do { \
|
#define make_null_str(s) do { \
|
||||||
FL_SET(s, ELTS_SHARED); \
|
FL_SET(s, ELTS_SHARED); \
|
||||||
RSTRING(s)->ptr = (char *)null_str; \
|
RSTRING(s)->ptr = (char *)null_str; \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue