From 86e3d63772533d6b301ab0d9e73b719c47d96f7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Fri, 12 Jun 2020 12:35:45 +0900 Subject: SPECIAL_SINGLETON: no longer used This macro does not improve any readability and/or runtime performance. --- class.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'class.c') diff --git a/class.c b/class.c index 7719b06208..47bb56230f 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 -- cgit v1.2.3