summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--compile.c2
-rw-r--r--vm_core.h6
3 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index e91eab7..f95f231 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/compile.c b/compile.c
index 637f56f..26ee3b2 100644
--- a/compile.c
+++ b/compile.c
@@ -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;
diff --git a/vm_core.h b/vm_core.h
index a032daa..6745837 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -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,