From 38f1da6f26bde5185612b66a1b1fc94f78654d78 Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Mon, 10 Jun 2019 18:46:57 +0900 Subject: `Kernel#global_variables` should not include undefined `$1`-`$9` - They are not include in Ruby. - Appear in duplicate when `$1`-`$9` are defined. --- src/variable.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/variable.c') diff --git a/src/variable.c b/src/variable.c index ee21a3b96..779f206dc 100644 --- a/src/variable.c +++ b/src/variable.c @@ -965,16 +965,8 @@ mrb_f_global_variables(mrb_state *mrb, mrb_value self) { iv_tbl *t = mrb->globals; mrb_value ary = mrb_ary_new(mrb); - size_t i; - char buf[3]; iv_foreach(mrb, t, gv_i, &ary); - buf[0] = '$'; - buf[2] = 0; - for (i = 1; i <= 9; ++i) { - buf[1] = (char)(i + '0'); - mrb_ary_push(mrb, ary, mrb_symbol_value(mrb_intern(mrb, buf, 2))); - } return ary; } -- cgit v1.2.3