summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-06-24 01:12:05 +0900
committerYukihiro Matsumoto <[email protected]>2012-06-24 01:12:05 +0900
commitd657e26d35ef31314a97d42bacc3e5dc85689404 (patch)
tree9f3332369c369638ea3da5541894b05c7228ecee
parentc261e4f360106eeb5d9193c30410818884e19ccc (diff)
downloadmruby-d657e26d35ef31314a97d42bacc3e5dc85689404.tar.gz
mruby-d657e26d35ef31314a97d42bacc3e5dc85689404.zip
pacify const assignment warning
-rw-r--r--src/class.c8
-rw-r--r--src/struct.c2
2 files changed, 3 insertions, 7 deletions
diff --git a/src/class.c b/src/class.c
index a9bf54a3b..881a0072e 100644
--- a/src/class.c
+++ b/src/class.c
@@ -966,15 +966,14 @@ mrb_value
mrb_class_path(mrb_state *mrb, struct RClass *c)
{
mrb_value path;
+ const char *name;
+ int len;
path = mrb_obj_iv_get(mrb, (struct RObject*)c, mrb_intern(mrb, "__classpath__"));
if (mrb_nil_p(path)) {
struct RClass *outer = mrb_class_outer_module(mrb, c);
mrb_sym sym = class_sym(mrb, c, outer);
if (outer && outer != mrb->object_class) {
- char *name;
- int len;
-
mrb_value base = mrb_class_path(mrb, outer);
path = mrb_str_plus(mrb, base, mrb_str_new(mrb, "::", 2));
name = mrb_sym2name_len(mrb, sym, &len);
@@ -984,9 +983,6 @@ mrb_class_path(mrb_state *mrb, struct RClass *c)
return mrb_nil_value();
}
else {
- char *name;
- int len;
-
name = mrb_sym2name_len(mrb, sym, &len);
path = mrb_str_new(mrb, name, len);
}
diff --git a/src/struct.c b/src/struct.c
index 60a0edb5b..855974182 100644
--- a/src/struct.c
+++ b/src/struct.c
@@ -521,7 +521,7 @@ inspect_struct(mrb_state *mrb, mrb_value s, mrb_value dummy, int recur)
slot = ptr_members[i];
id = SYM2ID(slot);
if (mrb_is_local_id(id) || mrb_is_const_id(id)) {
- char *name;
+ const char *name;
int len;
name = mrb_sym2name_len(mrb, id, &len);