mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[Bug #20998] Check if the string is frozen in rb_str_locktmp() & rb_str_unlocktmp()
This commit is contained in:
parent
cce4bfdca9
commit
83fb07fb2c
Notes:
git
2025-06-16 20:59:22 +00:00
2 changed files with 4 additions and 2 deletions
2
string.c
2
string.c
|
@ -3664,6 +3664,7 @@ RUBY_ALIAS_FUNCTION(rb_str_dup_frozen(VALUE str), rb_str_new_frozen, (str))
|
|||
VALUE
|
||||
rb_str_locktmp(VALUE str)
|
||||
{
|
||||
rb_check_frozen(str);
|
||||
if (FL_TEST(str, STR_TMPLOCK)) {
|
||||
rb_raise(rb_eRuntimeError, "temporal locking already locked string");
|
||||
}
|
||||
|
@ -3674,6 +3675,7 @@ rb_str_locktmp(VALUE str)
|
|||
VALUE
|
||||
rb_str_unlocktmp(VALUE str)
|
||||
{
|
||||
rb_check_frozen(str);
|
||||
if (!FL_TEST(str, STR_TMPLOCK)) {
|
||||
rb_raise(rb_eRuntimeError, "temporal unlocking already unlocked string");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue