diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-24 08:14:05 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-24 08:14:05 +0000 |
commit | 23e8deaf0d4d44746d838489cc112c5fc4684402 (patch) | |
tree | 065095c5b77bd45e86df48f110dfe52d0d58630d /string.c | |
parent | 58d3597e743967bb4c486b108e7dcd0db5c3efca (diff) |
* array.c, gc.c, hash.c, object.c, string.c, struct.c,
transcode.c, variable.c, vm.c, vm_insnhelper.c, vm_method.c:
replace calls to rb_error_frozen() with rb_check_frozen(). a
patch from Run Paint Run Run at [ruby-core:32014]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 14 |
1 files changed, 3 insertions, 11 deletions
@@ -350,14 +350,6 @@ str_mod_check(VALUE s, const char *p, long len) } } -static inline void -str_frozen_check(VALUE s) -{ - if (OBJ_FROZEN(s)) { - rb_raise(rb_eRuntimeError, "string frozen"); - } -} - size_t rb_str_capacity(VALUE str) { @@ -1250,7 +1242,7 @@ str_modifiable(VALUE str) if (FL_TEST(str, STR_TMPLOCK)) { rb_raise(rb_eRuntimeError, "can't modify string; temporarily locked"); } - if (OBJ_FROZEN(str)) rb_error_frozen("string"); + rb_check_frozen(str); if (!OBJ_UNTRUSTED(str) && rb_safe_level() >= 4) rb_raise(rb_eSecurityError, "Insecure: can't modify string"); } @@ -1335,7 +1327,7 @@ void rb_str_associate(VALUE str, VALUE add) { /* sanity check */ - if (OBJ_FROZEN(str)) rb_error_frozen("string"); + rb_check_frozen(str); if (STR_ASSOC_P(str)) { /* already associated */ rb_ary_concat(RSTRING(str)->as.heap.aux.shared, add); @@ -3546,7 +3538,7 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str) repl = rb_obj_as_string(repl); } str_mod_check(str, p, len); - str_frozen_check(str); + rb_check_frozen(str); } else { repl = rb_reg_regsub(repl, str, regs, pat); |