* vm_method.c (rb_add_method_iseq): use intermediate struct to
avoid initializing struct with variables. [Bug #11217] * method.h: add a comment about it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d4e752134f
commit
0f419d39b4
@ -1,3 +1,11 @@
|
|||||||
|
Fri Jun 5 01:06:02 2015 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* vm_method.c (rb_add_method_iseq): use intermediate struct to
|
||||||
|
avoid initializing struct with variables.
|
||||||
|
[Bug #11217]
|
||||||
|
|
||||||
|
* method.h: add a comment about it.
|
||||||
|
|
||||||
Fri Jun 5 00:55:21 2015 Koichi Sasada <ko1@atdot.net>
|
Fri Jun 5 00:55:21 2015 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* method.h: constify rb_method_refined_t::orig_me.
|
* method.h: constify rb_method_refined_t::orig_me.
|
||||||
|
2
method.h
2
method.h
@ -60,7 +60,7 @@ typedef struct rb_iseq_struct rb_iseq_t;
|
|||||||
typedef struct rb_method_iseq_struct {
|
typedef struct rb_method_iseq_struct {
|
||||||
rb_iseq_t * const iseqptr; /* should be separated from iseqval */
|
rb_iseq_t * const iseqptr; /* should be separated from iseqval */
|
||||||
rb_cref_t * const cref; /* shoudl be marked */
|
rb_cref_t * const cref; /* shoudl be marked */
|
||||||
} rb_method_iseq_t;
|
} rb_method_iseq_t; /* check rb_add_method_iseq() when modify the fields */
|
||||||
|
|
||||||
typedef struct rb_method_cfunc_struct {
|
typedef struct rb_method_cfunc_struct {
|
||||||
VALUE (*func)(ANYARGS);
|
VALUE (*func)(ANYARGS);
|
||||||
|
12
vm_method.c
12
vm_method.c
@ -562,11 +562,15 @@ void
|
|||||||
rb_add_method_iseq(VALUE klass, ID mid, VALUE iseqval, rb_cref_t *cref, rb_method_visibility_t visi)
|
rb_add_method_iseq(VALUE klass, ID mid, VALUE iseqval, rb_cref_t *cref, rb_method_visibility_t visi)
|
||||||
{
|
{
|
||||||
rb_iseq_t *iseq;
|
rb_iseq_t *iseq;
|
||||||
|
struct { /* should be same fields with rb_method_iseq_struct */
|
||||||
|
rb_iseq_t *iseqptr;
|
||||||
|
rb_cref_t *cref;
|
||||||
|
} iseq_body;
|
||||||
|
|
||||||
GetISeqPtr(iseqval, iseq);
|
GetISeqPtr(iseqval, iseq);
|
||||||
{
|
iseq_body.iseqptr = iseq;
|
||||||
rb_method_iseq_t iseq_body = {iseq, cref};
|
iseq_body.cref = cref;
|
||||||
rb_add_method(klass, mid, VM_METHOD_TYPE_ISEQ, &iseq_body, visi);
|
rb_add_method(klass, mid, VM_METHOD_TYPE_ISEQ, &iseq_body, visi);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static rb_method_entry_t *
|
static rb_method_entry_t *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user