ruby-changes:40480
From: ko1 <ko1@a...>
Date: Sat, 14 Nov 2015 02:20:19 +0900 (JST)
Subject: [ruby-changes:40480] ko1:r52561 (trunk): * method.h: constify rb_cref_t::scope_visi;
ko1 2015-11-14 02:20:11 +0900 (Sat, 14 Nov 2015) New Revision: 52561 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52561 Log: * method.h: constify rb_cref_t::scope_visi; * eval_intern.h (CREF_SCOPE_VISI_COPY): catch up this fix. * vm_method.c: ditto. Modified files: trunk/ChangeLog trunk/eval_intern.h trunk/method.h trunk/vm_method.c Index: eval_intern.h =================================================================== --- eval_intern.h (revision 52560) +++ eval_intern.h (revision 52561) @@ -216,7 +216,7 @@ static inline void https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L216 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; Index: method.h =================================================================== --- method.h (revision 52560) +++ method.h (revision 52561) @@ -42,7 +42,7 @@ typedef struct rb_cref_struct { https://github.com/ruby/ruby/blob/trunk/method.h#L42 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 */ Index: ChangeLog =================================================================== --- ChangeLog (revision 52560) +++ ChangeLog (revision 52561) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Nov 14 02:19:16 2015 Koichi Sasada <ko1@a...> + + * 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@g...> * pack.c (pack_unpack, AVOID_CC_BUG): Very ugly workaround for Index: vm_method.c =================================================================== --- vm_method.c (revision 52560) +++ vm_method.c (revision 52561) @@ -1048,20 +1048,24 @@ rb_scope_module_func_check(void) https://github.com/ruby/ruby/blob/trunk/vm_method.c#L1048 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/