From 05711c45af45f19ce570863786ee2ed7cc6aabc2 Mon Sep 17 00:00:00 2001 From: ko1 Date: Mon, 5 Nov 2018 08:02:29 +0000 Subject: use `RSTRUCT_CONST_PTR` carefully. * struct.c: should not use `RSTRUCT_CONST_PTR` with method dispatch because pointers can be obsolete after method dispatch. `rb_equal()` and so on can dispatch Ruby's methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- struct.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/struct.c b/struct.c index ece7ebc8a1..5e90f65506 100644 --- a/struct.c +++ b/struct.c @@ -1135,15 +1135,12 @@ rb_struct_select(int argc, VALUE *argv, VALUE s) static VALUE recursive_equal(VALUE s, VALUE s2, int recur) { - const VALUE *ptr, *ptr2; long i, len; if (recur) return Qtrue; /* Subtle! */ - ptr = RSTRUCT_CONST_PTR(s); - ptr2 = RSTRUCT_CONST_PTR(s2); len = RSTRUCT_LEN(s); for (i=0; i