ruby-changes:64486
From: Kenta <ko1@a...>
Date: Wed, 23 Dec 2020 09:25:30 +0900 (JST)
Subject: [ruby-changes:64486] b3ea828c8e (master): [memory_view] Add mdview_release_view for test
https://git.ruby-lang.org/ruby.git/commit/?id=b3ea828c8e From b3ea828c8ef92f2fab4646f72144f7c468339a81 Mon Sep 17 00:00:00 2001 From: Kenta Murata <mrkn@m...> Date: Wed, 23 Dec 2020 00:40:54 +0900 Subject: [memory_view] Add mdview_release_view for test diff --git a/ext/-test-/memory_view/memory_view.c b/ext/-test-/memory_view/memory_view.c index c847eac..cb07064 100644 --- a/ext/-test-/memory_view/memory_view.c +++ b/ext/-test-/memory_view/memory_view.c @@ -307,6 +307,16 @@ mdview_get_memory_view(VALUE obj, rb_memory_view_t *view, int flags) https://github.com/ruby/ruby/blob/trunk/ext/-test-/memory_view/memory_view.c#L307 view->ndim = ndim; view->shape = shape; view->strides = strides; + view->sub_offsets = NULL; + + return true; +} + +static bool +mdview_release_memory_view(VALUE obj, rb_memory_view_t *view) +{ + if (view->shape) xfree(view->shape); + if (view->strides) xfree(view->strides); return true; } @@ -319,7 +329,7 @@ mdview_memory_view_available_p(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ext/-test-/memory_view/memory_view.c#L329 static const rb_memory_view_entry_t mdview_memory_view_entry = { mdview_get_memory_view, - NULL, + mdview_release_memory_view, mdview_memory_view_available_p }; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/