mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
flock,flatten,signal to main_thread
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e004116073
commit
94a1bece4a
14 changed files with 242 additions and 122 deletions
35
string.c
35
string.c
|
@ -84,23 +84,25 @@ VALUE
|
|||
str_new4(orig)
|
||||
VALUE orig;
|
||||
{
|
||||
NEWOBJ(str, struct RString);
|
||||
OBJSETUP(str, cString, T_STRING);
|
||||
|
||||
str->len = RSTRING(orig)->len;
|
||||
str->ptr = RSTRING(orig)->ptr;
|
||||
if (RSTRING(orig)->orig) {
|
||||
str->orig = RSTRING(orig)->orig;
|
||||
return str_freeze(RSTRING(orig)->orig);
|
||||
}
|
||||
else if (FL_TEST(orig, STR_FREEZE)) {
|
||||
return orig;
|
||||
}
|
||||
else {
|
||||
NEWOBJ(str, struct RString);
|
||||
OBJSETUP(str, cString, T_STRING);
|
||||
|
||||
str->len = RSTRING(orig)->len;
|
||||
str->ptr = RSTRING(orig)->ptr;
|
||||
RSTRING(orig)->orig = (VALUE)str;
|
||||
str->orig = 0;
|
||||
if (rb_safe_level() >= 3) {
|
||||
FL_SET(str, STR_TAINT);
|
||||
}
|
||||
return (VALUE)str;
|
||||
}
|
||||
if (rb_safe_level() >= 3) {
|
||||
FL_SET(str, STR_TAINT);
|
||||
}
|
||||
|
||||
return (VALUE)str;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -362,12 +364,15 @@ str_frozen_p(str)
|
|||
}
|
||||
|
||||
VALUE
|
||||
str_dup_freezed(str)
|
||||
str_dup_frozen(str)
|
||||
VALUE str;
|
||||
{
|
||||
str = str_dup(str);
|
||||
str_freeze(str);
|
||||
return str;
|
||||
if (RSTRING(str)->orig) {
|
||||
return str_freeze(RSTRING(str)->orig);
|
||||
}
|
||||
if (FL_TEST(str, STR_FREEZE))
|
||||
return str;
|
||||
return str_freeze(str_dup(str));
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue