diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-04 16:08:40 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-04 16:08:40 +0000 |
commit | 0f419d39b4eebe9b3726bec19472de48bb23ad03 (patch) | |
tree | 49cb1aa3d9a2cfbb3704c013d51fab99bdc32633 /vm_method.c | |
parent | d4e752134f74ba2cc82aeae07cc0f1974bf9fa6b (diff) | |
download | ruby-0f419d39b4eebe9b3726bec19472de48bb23ad03.tar.gz |
* 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
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/vm_method.c b/vm_method.c index 8d08272d02..e59a161cc2 100644 --- a/vm_method.c +++ b/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_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); - { - rb_method_iseq_t iseq_body = {iseq, cref}; - rb_add_method(klass, mid, VM_METHOD_TYPE_ISEQ, &iseq_body, visi); - } + iseq_body.iseqptr = iseq; + iseq_body.cref = cref; + rb_add_method(klass, mid, VM_METHOD_TYPE_ISEQ, &iseq_body, visi); } static rb_method_entry_t * |