[前][次][番号順一覧][スレッド一覧]

ruby-changes:39958

From: nobu <ko1@a...>
Date: Mon, 5 Oct 2015 16:10:27 +0900 (JST)
Subject: [ruby-changes:39958] nobu:r52039 (trunk): eval_intern.h: pass_passed_block

nobu	2015-10-05 16:10:21 +0900 (Mon, 05 Oct 2015)

  New Revision: 52039

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52039

  Log:
    eval_intern.h: pass_passed_block
    
    * eval_intern.h (pass_passed_block): make helper inline function.

  Modified files:
    trunk/eval_intern.h
    trunk/vm_eval.c
Index: eval_intern.h
===================================================================
--- eval_intern.h	(revision 52038)
+++ eval_intern.h	(revision 52039)
@@ -4,15 +4,14 @@ https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L4
 #include "ruby/ruby.h"
 #include "vm_core.h"
 
-#define PASS_PASSED_BLOCK_TH(th) do { \
-    (th)->passed_block = rb_vm_control_frame_block_ptr(th->cfp); \
-    (th)->cfp->flag |= VM_FRAME_FLAG_PASSED; \
-} while (0)
-
-#define PASS_PASSED_BLOCK() do { \
-    rb_thread_t * const __th__ = GET_THREAD(); \
-    PASS_PASSED_BLOCK_TH(__th__); \
-} while (0)
+static inline void
+pass_passed_block(rb_thread_t *th)
+{
+    th->passed_block = rb_vm_control_frame_block_ptr(th->cfp);
+    th->cfp->flag |= VM_FRAME_FLAG_PASSED;
+}
+#define PASS_PASSED_BLOCK_TH(th) pass_passed_block(th)
+#define PASS_PASSED_BLOCK() pass_passed_block(GET_THREAD())
 
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 52038)
+++ vm_eval.c	(revision 52039)
@@ -859,7 +859,7 @@ rb_funcallv_public(VALUE recv, ID mid, i https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L859
 VALUE
 rb_funcall_passing_block(VALUE recv, ID mid, int argc, const VALUE *argv)
 {
-    PASS_PASSED_BLOCK_TH(GET_THREAD());
+    PASS_PASSED_BLOCK();
 
     return rb_call(recv, mid, argc, argv, CALL_PUBLIC);
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]