summaryrefslogtreecommitdiff
path: root/ext/-test-
diff options
context:
space:
mode:
authorKenta Murata <mrkn@mrkn.jp>2020-12-23 00:43:18 +0900
committerKenta Murata <mrkn@mrkn.jp>2020-12-23 09:24:54 +0900
commitdb0385d6576bb9d2486e799c935e6b1fa1e7dfcc (patch)
tree00b2b0f331779bb74ece08fbff1cf8fd2cc229bb /ext/-test-
parentb3ea828c8ef92f2fab4646f72144f7c468339a81 (diff)
[memory_view] Remove needless use of StringValueCStr
Diffstat (limited to 'ext/-test-')
-rw-r--r--ext/-test-/memory_view/memory_view.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ext/-test-/memory_view/memory_view.c b/ext/-test-/memory_view/memory_view.c
index cb07064cd72..79a64cfa5ce 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)
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)
}
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;