ruby-changes:63135
From: Kenta <ko1@a...>
Date: Fri, 25 Sep 2020 23:56:58 +0900 (JST)
Subject: [ruby-changes:63135] 8119e5b0e6 (master): memory_view.c: prevent "warning: instance variable __memory_view__ not initialized"
https://git.ruby-lang.org/ruby.git/commit/?id=8119e5b0e6 From 8119e5b0e6a1341a9130c14604ade5acca6d21f3 Mon Sep 17 00:00:00 2001 From: Kenta Murata <mrkn@m...> Date: Fri, 25 Sep 2020 23:45:00 +0900 Subject: memory_view.c: prevent "warning: instance variable __memory_view__ not initialized" diff --git a/memory_view.c b/memory_view.c index e45cbeb..6d75b9d 100644 --- a/memory_view.c +++ b/memory_view.c @@ -7,6 +7,7 @@ https://github.com/ruby/ruby/blob/trunk/memory_view.c#L7 **********************************************************************/ #include "internal.h" +#include "internal/variable.h" #include "internal/util.h" #include "ruby/memory_view.h" @@ -31,7 +32,7 @@ static const rb_data_type_t memory_view_entry_data_type = { https://github.com/ruby/ruby/blob/trunk/memory_view.c#L32 bool rb_memory_view_register(VALUE klass, const rb_memory_view_entry_t *entry) { Check_Type(klass, T_CLASS); - VALUE entry_obj = rb_ivar_get(klass, id_memory_view); + VALUE entry_obj = rb_ivar_lookup(klass, id_memory_view, Qnil); if (! NIL_P(entry_obj)) { rb_warning("Duplicated registration of memory view to %"PRIsVALUE, klass); return 0; @@ -447,14 +448,14 @@ rb_memory_view_get_item_pointer(rb_memory_view_t *view, const ssize_t *indices) https://github.com/ruby/ruby/blob/trunk/memory_view.c#L448 static const rb_memory_view_entry_t * lookup_memory_view_entry(VALUE klass) { - VALUE entry_obj = rb_ivar_get(klass, id_memory_view); + VALUE entry_obj = rb_ivar_lookup(klass, id_memory_view, Qnil); while (NIL_P(entry_obj)) { klass = rb_class_get_superclass(klass); if (klass == rb_cBasicObject || klass == rb_cObject) return NULL; - entry_obj = rb_ivar_get(klass, id_memory_view); + entry_obj = rb_ivar_lookup(klass, id_memory_view, Qnil); } if (! rb_typeddata_is_kind_of(entry_obj, &memory_view_entry_data_type)) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/