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

ruby-changes:62066

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Mon, 29 Jun 2020 11:08:44 +0900 (JST)
Subject: [ruby-changes:62066] f402dc3557 (master): rb_szqueue_push: do not goto into a branch

https://git.ruby-lang.org/ruby.git/commit/?id=f402dc3557

From f402dc35572ae6167737e82585f92d3cc861d1da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
Date: Fri, 19 Jun 2020 10:56:25 +0900
Subject: rb_szqueue_push: do not goto into a branch

I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.

diff --git a/thread_sync.c b/thread_sync.c
index 3689dee..3b8c536 100644
--- a/thread_sync.c
+++ b/thread_sync.c
@@ -1156,7 +1156,7 @@ rb_szqueue_push(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L1156
 	    rb_raise(rb_eThreadError, "queue full");
 	}
 	else if (queue_closed_p(self)) {
-	    goto closed;
+            break;
 	}
 	else {
 	    struct queue_waiter qw;
@@ -1172,7 +1172,6 @@ rb_szqueue_push(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L1172
     }
 
     if (queue_closed_p(self)) {
-      closed:
 	raise_closed_queue_error(self);
     }
 
-- 
cgit v0.10.2


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

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