summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-13 17:20:11 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-13 17:20:11 (GMT)
commitdd4cec36ca0229e5dcc45393f59f2633d2e350bf (patch)
tree103742b8a708b0ffe530370e3a5f124ca7f64b68
parent6687b34876a2677bb1d7288de82376960fb35ec7 (diff)
* method.h: constify rb_cref_t::scope_visi;
* eval_intern.h (CREF_SCOPE_VISI_COPY): catch up this fix. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--eval_intern.h2
-rw-r--r--method.h2
-rw-r--r--vm_method.c16
4 files changed, 20 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 3b6bd48..3b43b1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Sat Nov 14 02:19:16 2015 Koichi Sasada <ko1@atdot.net>
+
+ * method.h: constify rb_cref_t::scope_visi;
+
+ * eval_intern.h (CREF_SCOPE_VISI_COPY): catch up this fix.
+
+ * vm_method.c: ditto.
+
Sat Nov 14 01:53:52 2015 Naohisa Goto <ngotogenome@gmail.com>
* pack.c (pack_unpack, AVOID_CC_BUG): Very ugly workaround for
diff --git a/eval_intern.h b/eval_intern.h
index 6b5ca7f..d78bb39 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -216,7 +216,7 @@ static inline void
CREF_SCOPE_VISI_COPY(rb_cref_t *dst_cref, const rb_cref_t *src_cref)
{
const rb_scope_visibility_t *src = &src_cref->scope_visi;
- rb_scope_visibility_t *dst = &dst_cref->scope_visi;
+ rb_scope_visibility_t *dst = (rb_scope_visibility_t *)&dst_cref->scope_visi; /* OK for const cast */
dst->method_visi = src->method_visi;
dst->module_func = src->module_func;
diff --git a/method.h b/method.h
index 21a02bc..d36cf38 100644
--- a/method.h
+++ b/method.h
@@ -42,7 +42,7 @@ typedef struct rb_cref_struct {
const VALUE refinements;
const VALUE klass;
struct rb_cref_struct * const next;
- rb_scope_visibility_t scope_visi;
+ const rb_scope_visibility_t scope_visi;
} rb_cref_t;
/* method data type */
diff --git a/vm_method.c b/vm_method.c
index 7d658b0..6c2137b 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -1048,20 +1048,24 @@ rb_scope_module_func_check(void)
return CREF_SCOPE_VISI(rb_vm_cref())->module_func;
}
+static void
+vm_cref_set_visibility(rb_method_visibility_t method_visi, int module_func)
+{
+ rb_scope_visibility_t *scope_visi = (rb_scope_visibility_t *)&rb_vm_cref()->scope_visi;
+ scope_visi->method_visi = method_visi;
+ scope_visi->module_func = module_func;
+}
+
void
rb_scope_visibility_set(rb_method_visibility_t visi)
{
- rb_scope_visibility_t *scope_visi = &rb_vm_cref()->scope_visi;
- scope_visi->method_visi = visi;
- scope_visi->module_func = FALSE;
+ vm_cref_set_visibility(visi, FALSE);
}
static void
rb_scope_module_func_set(void)
{
- rb_scope_visibility_t *scope_visi = &rb_vm_cref()->scope_visi;
- scope_visi->method_visi = METHOD_VISI_PRIVATE;
- scope_visi->module_func = TRUE;
+ vm_cref_set_visibility(METHOD_VISI_PRIVATE, TRUE);
}
void