diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-12 12:35:45 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-29 11:05:41 +0900 |
commit | 86e3d63772533d6b301ab0d9e73b719c47d96f7f (patch) | |
tree | 6bf64165fd203506fb72e36a4d0c91c32383b1be /class.c | |
parent | 8d182b04ed04378877e743535658be41a05aef74 (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.c | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -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 |