SPECIAL_SINGLETON: no longer used

This macro does not improve any readability and/or runtime performance.
This commit is contained in:
卜部昌平 2020-06-12 12:35:45 +09:00
parent 8d182b04ed
commit 86e3d63772
Notes: git 2020-06-29 11:07:14 +09:00

16
class.c
View File

@ -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 static inline VALUE
special_singleton_class_of(VALUE obj) special_singleton_class_of(VALUE obj)
{ {
SPECIAL_SINGLETON(Qnil, rb_cNilClass); switch (obj) {
SPECIAL_SINGLETON(Qfalse, rb_cFalseClass); case Qnil: return rb_cNilClass;
SPECIAL_SINGLETON(Qtrue, rb_cTrueClass); case Qfalse: return rb_cFalseClass;
return Qnil; case Qtrue: return rb_cTrueClass;
default: return Qnil;
}
} }
VALUE VALUE