diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | compile.c | 2 | ||||
-rw-r--r-- | vm_core.h | 6 |
3 files changed, 12 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Wed Aug 12 21:15:27 2015 Eric Wong <e@80x24.org> + + * vm_core.h (rb_call_info_kw_arg_bytes): extract from compile.c + * compile.c (iseq_build_callinfo_from_hash): use above function + Wed Aug 12 18:00:17 2015 Koichi Sasada <ko1@atdot.net> * class.c (move_refined_method): same as the last commit. @@ -5917,7 +5917,7 @@ iseq_build_callinfo_from_hash(rb_iseq_t *iseq, VALUE op) if (!NIL_P(vkw_arg)) { int i; int len = RARRAY_LENINT(vkw_arg); - size_t n = sizeof(rb_call_info_kw_arg_t) + sizeof(VALUE) * (len - 1); + size_t n = rb_call_info_kw_arg_bytes(len); kw_arg = xmalloc(n); kw_arg->keyword_len = len; @@ -180,6 +180,12 @@ typedef struct rb_call_info_kw_arg_struct { VALUE keywords[1]; } rb_call_info_kw_arg_t; +static inline size_t +rb_call_info_kw_arg_bytes(int keyword_len) +{ + return sizeof(rb_call_info_kw_arg_t) + sizeof(VALUE) * (keyword_len - 1); +} + enum method_missing_reason { MISSING_NOENTRY = 0x00, MISSING_PRIVATE = 0x01, |