diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-01-10 17:57:33 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-01-10 17:57:33 +0900 |
| commit | fc8fb41451b07b3fda0726ba80e88e509ad02452 (patch) | |
| tree | 1259fd462f19045ea663d1804d10ce6d15f6c94e /mrbgems/mruby-hash-ext | |
| parent | dc86e35cac6d4fd1825cf2572c83e0f82736f0d1 (diff) | |
| download | mruby-fc8fb41451b07b3fda0726ba80e88e509ad02452.tar.gz mruby-fc8fb41451b07b3fda0726ba80e88e509ad02452.zip | |
Small refactoring in `hash_slice`; ref #4926
Diffstat (limited to 'mrbgems/mruby-hash-ext')
| -rw-r--r-- | mrbgems/mruby-hash-ext/src/hash-ext.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/mrbgems/mruby-hash-ext/src/hash-ext.c b/mrbgems/mruby-hash-ext/src/hash-ext.c index e6112667b..75ebd412b 100644 --- a/mrbgems/mruby-hash-ext/src/hash-ext.c +++ b/mrbgems/mruby-hash-ext/src/hash-ext.c @@ -53,10 +53,8 @@ hash_slice(mrb_state *mrb, mrb_value hash) mrb_int argc, i; mrb_get_args(mrb, "*", &argv, &argc); - if (argc == 0) { - return mrb_hash_new_capa(mrb, argc); - } result = mrb_hash_new_capa(mrb, argc); + if (argc == 0) return result; /* empty hash */ for (i = 0; i < argc; i++) { mrb_value key = argv[i]; mrb_value val; |
