From 08f3cfb5859332c0f7a9a574dc64a2a002c50354 Mon Sep 17 00:00:00 2001 From: ko1 Date: Wed, 11 Mar 2015 23:13:01 +0000 Subject: * internal.h: use T_IMEMO to represent `struct MEMO' value. memo->v1 and memo->v2 is WB protected values. So use MEMO_V1/V2_SET() macros to set these values. memo->u3 is ambiguous (sometimes a VALUE, sometimes an integer value), so use gc_mark_maybe() in gc.c to mark it. Rename NEW_MEMO() to MEMO_NEW(). Move MEMO_FOR and NEW_MEMO_FOF macros from node.h. Export a rb_imemo_new() function for ext/ripper. * node.h: remove NODE_MEMO. * enum.c: catch up these change. * enumerator.c: ditto. * load.c: ditto. * ext/objspace/objspace.c (count_nodes): ditto. * gc.c (gc_mark_children): mark imemo_memo type. * parse.y (new_args_gen): use T_IMEMO. (I'm not sure it is working correctly...) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- enumerator.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'enumerator.c') diff --git a/enumerator.c b/enumerator.c index 433bd60f8e..7f91f32062 100644 --- a/enumerator.c +++ b/enumerator.c @@ -13,7 +13,6 @@ ************************************************/ #include "internal.h" -#include "node.h" /* * Document-class: Enumerator @@ -496,7 +495,7 @@ enumerator_with_index_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, m)) { struct MEMO *memo = (struct MEMO *)m; VALUE idx = memo->v1; - memo->v1 = rb_int_succ(idx); + MEMO_V1_SET(memo, rb_int_succ(idx)); if (argc <= 1) return rb_yield_values(2, val, idx); @@ -536,7 +535,7 @@ enumerator_with_index(int argc, VALUE *argv, VALUE obj) memo = INT2FIX(0); else memo = rb_to_int(memo); - return enumerator_block_call(obj, enumerator_with_index_i, (VALUE)NEW_MEMO(memo, 0, 0)); + return enumerator_block_call(obj, enumerator_with_index_i, (VALUE)MEMO_NEW(memo, 0, 0)); } /* -- cgit v1.2.3