ruby-changes:70053
From: Nobuyoshi <ko1@a...>
Date: Sat, 4 Dec 2021 10:36:11 +0900 (JST)
Subject: [ruby-changes:70053] d118e7c025 (master): Turn nd_type_p into an inline function
https://git.ruby-lang.org/ruby.git/commit/?id=d118e7c025 From d118e7c025adf0221fe16ad3a0d57ba9605fd2a7 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sat, 4 Dec 2021 10:35:44 +0900 Subject: Turn nd_type_p into an inline function --- node.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/node.h b/node.h index b2687aed132..4251638fb3d 100644 --- a/node.h +++ b/node.h @@ -193,7 +193,6 @@ typedef struct RNode { https://github.com/ruby/ruby/blob/trunk/node.h#L193 #define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT) #define nd_type(n) ((int) (((n)->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT)) -#define nd_type_p(n, t) (nd_type((n)) == (t)) #define nd_set_type(n,t) \ rb_node_set_type(n, t) #define nd_init_type(n,t) \ @@ -498,6 +497,11 @@ rb_node_set_type(NODE *n, enum node_type t) https://github.com/ruby/ruby/blob/trunk/node.h#L497 return nd_init_type(n, t); } +static inline bool +nd_type_p(const NODE *n, enum node_type t) +{ + return (enum node_type)nd_type(n) == t; +} #if defined(__cplusplus) #if 0 { /* satisfy cc-mode */ -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/