summaryrefslogtreecommitdiffhomepage
path: root/src/variable.c
diff options
context:
space:
mode:
authorKOBAYASHI Shuji <[email protected]>2019-06-10 18:46:57 +0900
committerKOBAYASHI Shuji <[email protected]>2019-06-10 18:46:57 +0900
commit38f1da6f26bde5185612b66a1b1fc94f78654d78 (patch)
treeaeab148f6ff6e2e8421a1022102cf2c2fbf7e996 /src/variable.c
parent04999e969f9cb0dcf70e313caae52f115163ab95 (diff)
downloadmruby-38f1da6f26bde5185612b66a1b1fc94f78654d78.tar.gz
mruby-38f1da6f26bde5185612b66a1b1fc94f78654d78.zip
`Kernel#global_variables` should not include undefined `$1`-`$9`
- They are not include in Ruby. - Appear in duplicate when `$1`-`$9` are defined.
Diffstat (limited to 'src/variable.c')
-rw-r--r--src/variable.c8
1 files changed, 0 insertions, 8 deletions
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;
}