summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-12 03:35:45 (GMT)
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 02:05:41 (GMT)
commit86e3d63772533d6b301ab0d9e73b719c47d96f7f (patch)
tree6bf64165fd203506fb72e36a4d0c91c32383b1be /class.c
parent8d182b04ed04378877e743535658be41a05aef74 (diff)
SPECIAL_SINGLETON: no longer used
This macro does not improve any readability and/or runtime performance.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3247
Diffstat (limited to 'class.c')
-rw-r--r--class.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/class.c b/class.c
index 7719b06..47bb562 100644
--- a/class.c
+++ b/class.c
@@ -1747,19 +1747,15 @@ rb_undef_methods_from(VALUE klass, VALUE super)
* \{
*/
-#define SPECIAL_SINGLETON(x,c) do {\
- if (obj == (x)) {\
- return (c);\
- }\
-} while (0)
-
static inline VALUE
special_singleton_class_of(VALUE obj)
{
- SPECIAL_SINGLETON(Qnil, rb_cNilClass);
- SPECIAL_SINGLETON(Qfalse, rb_cFalseClass);
- SPECIAL_SINGLETON(Qtrue, rb_cTrueClass);
- return Qnil;
+ switch (obj) {
+ case Qnil: return rb_cNilClass;
+ case Qfalse: return rb_cFalseClass;
+ case Qtrue: return rb_cTrueClass;
+ default: return Qnil;
+ }
}
VALUE