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

ruby-changes:17454

From: nobu <ko1@a...>
Date: Tue, 12 Oct 2010 23:03:29 +0900 (JST)
Subject: [ruby-changes:17454] Ruby:r29459 (trunk): * gc.c (mark_current_machine_context): suppress warnings.

nobu	2010-10-12 23:03:24 +0900 (Tue, 12 Oct 2010)

  New Revision: 29459

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

  Log:
    * gc.c (mark_current_machine_context): suppress warnings.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29458)
+++ ChangeLog	(revision 29459)
@@ -1,5 +1,7 @@
-Tue Oct 12 22:41:07 2010  Nobuyoshi Nakada  <nobu@r...>
+Tue Oct 12 23:03:20 2010  Nobuyoshi Nakada  <nobu@r...>
 
+	* gc.c (mark_current_machine_context): suppress warnings.
+
 	* compile.c (iseq_compile_each): fix truncating cast.
 
 	* cont.c (fiber_setcontext): missing variable definition.
Index: gc.c
===================================================================
--- gc.c	(revision 29458)
+++ gc.c	(revision 29459)
@@ -2272,22 +2272,25 @@
      (start = STACK_END, end = STACK_START) : (start = STACK_START, end = STACK_END+appendix))
 #endif
 
+#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
+
 static void
 mark_current_machine_context(rb_objspace_t *objspace, rb_thread_t *th)
 {
-    rb_jmp_buf save_regs_gc_mark;
+    union {
+	rb_jmp_buf j;
+	VALUE v[sizeof(rb_jmp_buf) / sizeof(VALUE)];
+    } save_regs_gc_mark;
     VALUE *stack_start, *stack_end;
 
     FLUSH_REGISTER_WINDOWS;
     /* This assumes that all registers are saved into the jmp_buf (and stack) */
-    rb_setjmp(save_regs_gc_mark);
+    rb_setjmp(save_regs_gc_mark.j);
 
     SET_STACK_END;
     GET_STACK_BOUNDS(stack_start, stack_end, 1);
 
-    mark_locations_array(objspace,
-			 (VALUE*)save_regs_gc_mark,
-			 sizeof(save_regs_gc_mark) / sizeof(VALUE));
+    mark_locations_array(objspace, save_regs_gc_mark.v, numberof(save_regs_gc_mark.v));
 
     rb_gc_mark_locations(stack_start, stack_end);
 #ifdef __ia64

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

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