diff --git a/Frameworks/Foundation/NSKeyValueCoding.mm b/Frameworks/Foundation/NSKeyValueCoding.mm index 1de02fc779..e0381f7d82 100644 --- a/Frameworks/Foundation/NSKeyValueCoding.mm +++ b/Frameworks/Foundation/NSKeyValueCoding.mm @@ -175,13 +175,12 @@ bool KVCGetViaAccessor(NSObject* self, SEL getter, id* ret) { return false; } - if (0 -#define APPLY_TYPE(type, name, capitalizedName, encodingChar) || (valueType[0] == encodingChar && (*ret = quickGet(self, getter))) - APPLY_TYPE(id, object, Object, '@') APPLY_TYPE(Class, class, Class, '#') + switch (valueType[0]) { +#define APPLY_TYPE(type, name, capitalizedName, encodingChar) case encodingChar: *ret = quickGet(self, getter); return true; + APPLY_TYPE(id, object, Object, '@') + APPLY_TYPE(Class, class, Class, '#') #include "type_encoding_cases.h" #undef APPLY_TYPE - ) { - return true; } NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:sig]; @@ -407,14 +406,17 @@ bool KVCSetViaAccessor(NSObject* self, SEL setter, id value) { if (sig && [sig numberOfArguments] == 3) { const char* valueType = [sig getArgumentTypeAtIndex:2]; - if (0 + switch (valueType[0]) { #define APPLY_TYPE(type, name, capitalizedName, encodingChar) \ - || (valueType[0] == encodingChar && quickSet(self, setter, value, valueType)) - APPLY_TYPE(id, object, Object, '@') APPLY_TYPE(Class, class, Class, '#') + case encodingChar: \ + if (quickSet(self, setter, value, valueType)) { \ + return true; \ + } \ + break; + APPLY_TYPE(id, object, Object, '@') + APPLY_TYPE(Class, class, Class, '#') #include "type_encoding_cases.h" #undef APPLY_TYPE - ) { - return true; } uint8_t* data = static_cast(_alloca(objc_sizeof_type(valueType)));