diff options
author | Koichi Sasada <ko1@atdot.net> | 2019-07-22 17:01:31 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2019-07-22 17:01:31 +0900 |
commit | f75561b8d455e1cf92dac8ac8838fdafc88cba71 (patch) | |
tree | b6d9155bf14448da923699250ca3e9d7c664293b /gc.c | |
parent | d1c2b1969814fee14a01296aa2867abd07f70d04 (diff) | |
download | ruby-f75561b8d455e1cf92dac8ac8838fdafc88cba71.tar.gz |
constify RHash::ifnone.
RHash::ifnone should be protected by write-barriers so this field
should be const. However, to introduce GC.compact, the const was
removed. This commit revert this removing `const` and modify
gc.c `TYPED_UPDATE_IF_MOVED` to remove `const` forcely by a type cast.
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -915,7 +915,7 @@ static inline void gc_prof_set_heap_info(rb_objspace_t *); #define TYPED_UPDATE_IF_MOVED(_objspace, _type, _thing) do { \ if (gc_object_moved_p(_objspace, (VALUE)_thing)) { \ - (_thing) = (_type)RMOVED((_thing))->destination; \ + *((_type *)(&_thing)) = (_type)RMOVED((_thing))->destination; \ } \ } while (0) |