Fix indirect counter increment

`*pcnt++` just dereferences `pcnt` then increments the local variable,
but has no side effect.
This commit is contained in:
Nobuyoshi Nakada 2022-12-27 11:21:46 +09:00
parent 04a2550928
commit ce47ee00ae
Notes: git 2025-04-09 13:49:37 +00:00
2 changed files with 3 additions and 2 deletions

View File

@ -1494,8 +1494,9 @@ assert_equal "#{n}#{n}", %Q{
# NameError
assert_equal "ok", %q{
obj = "".freeze # NameError refers the receiver indirectly
begin
bar
obj.bar
rescue => err
end
begin

View File

@ -3127,7 +3127,7 @@ obj_refer_only_shareables_p_i(VALUE obj, void *ptr)
int *pcnt = (int *)ptr;
if (!rb_ractor_shareable_p(obj)) {
*pcnt++;
++*pcnt;
}
}