summaryrefslogtreecommitdiffhomepage
path: root/src/vm.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-08-30 07:35:58 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-09-01 07:00:54 +0900
commite86c9cb57c0ee799ca66d18612e15c6c8983f872 (patch)
treef60224602ddf0cfb7bcca1546648b5d42d6e2a95 /src/vm.c
parent572a43de8406da89daeaa9b433761da762d7b1c4 (diff)
downloadmruby-e86c9cb57c0ee799ca66d18612e15c6c8983f872.tar.gz
mruby-e86c9cb57c0ee799ca66d18612e15c6c8983f872.zip
Do no use return values from `mrb_ensure_` functions.
They return the checking argument without modification, so the values are already there. Maybe we should change the return type to `void` but keep them unchanged for compatibility.
Diffstat (limited to 'src/vm.c')
-rw-r--r--src/vm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vm.c b/src/vm.c
index 50ad3b31d..a8120f5a5 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -2671,7 +2671,8 @@ RETRY_TRY_BLOCK:
int i;
int lim = a+b*2+1;
- hash = mrb_ensure_hash_type(mrb, regs[a]);
+ hash = regs[a];
+ mrb_ensure_hash_type(mrb, hash);
for (i=a+1; i<lim; i+=2) {
mrb_hash_set(mrb, hash, regs[i], regs[i+1]);
}
@@ -2679,8 +2680,9 @@ RETRY_TRY_BLOCK:
NEXT;
}
CASE(OP_HASHCAT, B) {
- mrb_value hash = mrb_ensure_hash_type(mrb, regs[a]);
+ mrb_value hash = regs[a];
+ mrb_ensure_hash_type(mrb, hash);
mrb_hash_merge(mrb, hash, regs[a+1]);
mrb_gc_arena_restore(mrb, ai);
NEXT;