ruby-changes:64483
From: Kenta <ko1@a...>
Date: Wed, 23 Dec 2020 09:25:29 +0900 (JST)
Subject: [ruby-changes:64483] db0385d657 (master): [memory_view] Remove needless use of StringValueCStr
https://git.ruby-lang.org/ruby.git/commit/?id=db0385d657 From db0385d6576bb9d2486e799c935e6b1fa1e7dfcc Mon Sep 17 00:00:00 2001 From: Kenta Murata <mrkn@m...> Date: Wed, 23 Dec 2020 00:43:18 +0900 Subject: [memory_view] Remove needless use of StringValueCStr diff --git a/ext/-test-/memory_view/memory_view.c b/ext/-test-/memory_view/memory_view.c index cb07064..79a64cf 100644 --- a/ext/-test-/memory_view/memory_view.c +++ b/ext/-test-/memory_view/memory_view.c @@ -268,9 +268,8 @@ 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#L268 VALUE shape_v = rb_ivar_get(obj, SYM2ID(sym_shape)); VALUE strides_v = rb_ivar_get(obj, SYM2ID(sym_strides)); - const char *format = RSTRING_PTR(format_v); const char *err; - const ssize_t item_size = rb_memory_view_item_size_from_format(format, &err); + const ssize_t item_size = rb_memory_view_item_size_from_format(RSTRING_PTR(format_v), &err); if (item_size < 0) { return false; } @@ -302,7 +301,7 @@ 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#L301 } rb_memory_view_init_as_byte_array(view, obj, RSTRING_PTR(buf_v), RSTRING_LEN(buf_v), true); - view->format = StringValueCStr(format_v); + view->format = RSTRING_PTR(format_v); view->item_size = item_size; view->ndim = ndim; view->shape = shape; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/