summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-26 01:17:17 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-26 01:17:17 +0000
commitf7bd951bead8460d422db320480062e911d18fc5 (patch)
tree7a959fce789e3af3933301856d107f3f74acc81c /variable.c
parentb2e60b2ce7a7cbcb8a67ac78606a18d3c2591d81 (diff)
downloadruby-f7bd951bead8460d422db320480062e911d18fc5.tar.gz
* variable.c (rb_f_global_variables): variable names should not
duplicate. [ruby-dev:32344] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/variable.c b/variable.c
index 6700ead280..a38bd8ea3c 100644
--- a/variable.c
+++ b/variable.c
@@ -716,14 +716,12 @@ rb_f_global_variables(void)
{
VALUE ary = rb_ary_new();
char buf[4];
- const char *s = "&`'+123456789";
+ const char *s = "123456789";
st_foreach_safe(rb_global_tbl, gvar_i, ary);
- if (!NIL_P(rb_backref_get())) {
- while (*s) {
- sprintf(buf, "$%c", *s++);
- rb_ary_push(ary, rb_str_new2(buf));
- }
+ while (*s) {
+ sprintf(buf, "$%c", *s++);
+ rb_ary_push(ary, ID2SYM(rb_intern(buf)));
}
return ary;
}