summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/class.c14
-rw-r--r--src/variable.c8
2 files changed, 7 insertions, 15 deletions
diff --git a/src/class.c b/src/class.c
index 6ceaa0cfa..373f2aec7 100644
--- a/src/class.c
+++ b/src/class.c
@@ -77,6 +77,12 @@ mrb_class_name_class(mrb_state *mrb, struct RClass *outer, struct RClass *c, mrb
mrb_obj_iv_set_force(mrb, (struct RObject*)c, nsym, name);
}
+mrb_bool
+mrb_const_name_p(mrb_state *mrb, const char *name, mrb_int len)
+{
+ return len > 0 && ISUPPER(name[0]) && mrb_ident_p(name+1, len-1);
+}
+
static void
setup_class(mrb_state *mrb, struct RClass *outer, struct RClass *c, mrb_sym id)
{
@@ -1852,18 +1858,12 @@ mrb_mod_undef(mrb_state *mrb, mrb_value mod)
return mrb_nil_value();
}
-static mrb_bool
-const_name_p(mrb_state *mrb, const char *name, mrb_int len)
-{
- return len > 0 && ISUPPER(name[0]) && mrb_ident_p(name+1, len-1);
-}
-
static void
check_const_name_sym(mrb_state *mrb, mrb_sym id)
{
mrb_int len;
const char *name = mrb_sym2name_len(mrb, id, &len);
- if (!const_name_p(mrb, name, len)) {
+ if (!mrb_const_name_p(mrb, name, len)) {
mrb_name_error(mrb, id, "wrong constant name %S", mrb_sym2str(mrb, id));
}
}
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;
}