ruby-changes:67154
From: Nobuyoshi <ko1@a...>
Date: Sat, 14 Aug 2021 23:12:23 +0900 (JST)
Subject: [ruby-changes:67154] d58620e0a1 (master): Rename labels in `Check_Type` more descriptive
https://git.ruby-lang.org/ruby.git/commit/?id=d58620e0a1 From d58620e0a1d03518a5cb49b954008d70ac7898d2 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sat, 14 Aug 2021 10:13:08 +0900 Subject: Rename labels in `Check_Type` more descriptive --- include/ruby/internal/value_type.h | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/include/ruby/internal/value_type.h b/include/ruby/internal/value_type.h index 1b4c651..790fc3b 100644 --- a/include/ruby/internal/value_type.h +++ b/include/ruby/internal/value_type.h @@ -337,25 +337,19 @@ static inline void https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/value_type.h#L337 Check_Type(VALUE v, enum ruby_value_type t) { if (RB_UNLIKELY(! RB_TYPE_P(v, t))) { - goto slowpath; + goto unexpected_type; } - else if (t != RUBY_T_DATA) { - goto fastpath; - } - else if (rbimpl_rtypeddata_p(v)) { + else if (t == RUBY_T_DATA && rbimpl_rtypeddata_p(v)) { /* The intention itself is not necessarily clear to me, but at least it * is intentional to rule out typed data here. See commit * a7c32bf81d3391cfb78cfda278f469717d0fb794. */ - goto slowpath; + goto unexpected_type; } else { - goto fastpath; + return; } - fastpath: - return; - - slowpath: /* <- :TODO: mark this label as cold. */ + unexpected_type: rb_unexpected_type(v, t); } -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/