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

ruby-changes:47445

From: ko1 <ko1@a...>
Date: Thu, 10 Aug 2017 12:34:41 +0900 (JST)
Subject: [ruby-changes:47445] ko1:r59561 (trunk): constify some variables.

ko1	2017-08-10 12:34:25 +0900 (Thu, 10 Aug 2017)

  New Revision: 59561

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

  Log:
    constify some variables.

  Modified files:
    trunk/cont.c
Index: cont.c
===================================================================
--- cont.c	(revision 59560)
+++ cont.c	(revision 59561)
@@ -240,8 +240,8 @@ cont_mark(void *ptr) https://github.com/ruby/ruby/blob/trunk/cont.c#L240
 	}
 	else {
 	    /* fiber */
-	    rb_thread_t *th = rb_thread_ptr(cont->saved_thread.self);
-	    rb_fiber_t *fib = (rb_fiber_t*)cont;
+	    const rb_thread_t *th = rb_thread_ptr(cont->saved_thread.self);
+	    const rb_fiber_t *fib = (rb_fiber_t*)cont;
 
 	    if ((th->fiber != fib) && FIBER_SUSPENDED_P(fib)) {
 		rb_gc_mark_locations(cont->machine.stack,
@@ -274,7 +274,7 @@ cont_free(void *ptr) https://github.com/ruby/ruby/blob/trunk/cont.c#L274
     }
     else {
 	/* fiber */
-	rb_fiber_t *fib = (rb_fiber_t*)cont;
+	const rb_fiber_t *fib = (rb_fiber_t*)cont;
 	const rb_thread_t *const th = GET_THREAD();
 #ifdef _WIN32
 	if (th && th->fiber != fib && cont->type != ROOT_FIBER_CONTEXT) {
@@ -362,7 +362,7 @@ fiber_verify(const rb_fiber_t *fib) https://github.com/ruby/ruby/blob/trunk/cont.c#L362
 }
 
 void
-rb_fiber_mark_self(rb_fiber_t *fib)
+rb_fiber_mark_self(const rb_fiber_t *fib)
 {
     if (fib)
 	rb_gc_mark(fib->cont.self);
@@ -585,7 +585,7 @@ cont_restore_thread(rb_context_t *cont) https://github.com/ruby/ruby/blob/trunk/cont.c#L585
     /* restore thread context */
     if (cont->type == CONTINUATION_CONTEXT) {
 	/* continuation */
-	rb_fiber_t *fib;
+	const rb_fiber_t *fib;
 
 	th->fiber = sth->fiber;
 	fib = th->fiber ? th->fiber : th->root_fiber;
@@ -1607,7 +1607,7 @@ rb_fiber_reset_root_local_storage(VALUE https://github.com/ruby/ruby/blob/trunk/cont.c#L1607
 VALUE
 rb_fiber_alive_p(VALUE fibval)
 {
-    rb_fiber_t *fib;
+    const rb_fiber_t *fib;
     GetFiberPtr(fibval, fib);
     return FIBER_TERMINATED_P(fib) ? Qfalse : Qtrue;
 }

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

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