Index: extra.mk.in ================================================================== --- extra.mk.in +++ extra.mk.in @@ -26,12 +26,10 @@ EXCEPTIONS_A = @EXCEPTIONS_A@ EXCEPTIONS_LIB_A = @EXCEPTIONS_LIB_A@ FISH_COMPLETIONS = @FISH_COMPLETIONS@ FORWARDING_A = @FORWARDING_A@ FORWARDING_LIB_A = @FORWARDING_LIB_A@ -INVOCATION_A = @INVOCATION_A@ -INVOCATION_LIB_A = @INVOCATION_LIB_A@ LIBBASES_M = @LIBBASES_M@ LIBOBJFWRT_DEP = @LIBOBJFWRT_DEP@ LIBOBJFWRT_DEP_LVL2 = @LIBOBJFWRT_DEP_LVL2@ LIBOBJFW_DEP = @LIBOBJFW_DEP@ LIBOBJFW_DEP_LVL2 = @LIBOBJFW_DEP_LVL2@ Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -177,14 +177,14 @@ [self finishInitialization]; return [self mutableCopy]; } /* From protocol OFComparing, but overridden in OFString */ -- (of_comparison_result_t)compare: (OFString *)object +- (of_comparison_result_t)compare: (OFString *)string { [self finishInitialization]; - return [self compare: object]; + return [self compare: string]; } /* From OFObject, but reimplemented in OFString */ - (bool)isEqual: (id)object { @@ -243,14 +243,14 @@ { [self finishInitialization]; return [self cStringLengthWithEncoding: encoding]; } -- (of_comparison_result_t)caseInsensitiveCompare: (OFString *)otherString +- (of_comparison_result_t)caseInsensitiveCompare: (OFString *)string { [self finishInitialization]; - return [self caseInsensitiveCompare: otherString]; + return [self caseInsensitiveCompare: string]; } - (of_unichar_t)characterAtIndex: (size_t)idx { [self finishInitialization]; Index: src/OFData.m ================================================================== --- src/OFData.m +++ src/OFData.m @@ -447,21 +447,18 @@ return false; return true; } -- (of_comparison_result_t)compare: (id )object +- (of_comparison_result_t)compare: (OFData *)data { - OFData *data; int comparison; size_t count, minCount; - if (![(id)object isKindOfClass: [OFData class]]) + if (![data isKindOfClass: [OFData class]]) @throw [OFInvalidArgumentException exception]; - data = (OFData *)object; - if (data.itemSize != _itemSize) @throw [OFInvalidArgumentException exception]; count = data.count; minCount = (_count > count ? count : _count); Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -563,22 +563,18 @@ - (id)copy { return [self retain]; } -- (of_comparison_result_t)compare: (id )object +- (of_comparison_result_t)compare: (OFDate *)date { - OFDate *otherDate; - - if (![(id)object isKindOfClass: [OFDate class]]) + if (![date isKindOfClass: [OFDate class]]) @throw [OFInvalidArgumentException exception]; - otherDate = (OFDate *)object; - - if (self.timeIntervalSince1970 < otherDate.timeIntervalSince1970) + if (self.timeIntervalSince1970 < date.timeIntervalSince1970) return OF_ORDERED_ASCENDING; - if (self.timeIntervalSince1970 > otherDate.timeIntervalSince1970) + if (self.timeIntervalSince1970 > date.timeIntervalSince1970) return OF_ORDERED_DESCENDING; return OF_ORDERED_SAME; } Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -940,18 +940,14 @@ return (number.longLongValue == self.longLongValue); return (number.unsignedLongLongValue == self.unsignedLongLongValue); } -- (of_comparison_result_t)compare: (id )object -{ - OFNumber *number; - - if (![(id)object isKindOfClass: [OFNumber class]]) - @throw [OFInvalidArgumentException exception]; - - number = (OFNumber *)object; +- (of_comparison_result_t)compare: (OFNumber *)number +{ + if (![number isKindOfClass: [OFNumber class]]) + @throw [OFInvalidArgumentException exception]; if (isFloat(self) || isFloat(number)) { double double1 = self.doubleValue; double double2 = number.doubleValue; Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -1512,30 +1512,30 @@ } - (bool)isEqual: (id)object { void *pool; - OFString *otherString; + OFString *string; const of_unichar_t *characters, *otherCharacters; size_t length; if (object == self) return true; if (![object isKindOfClass: [OFString class]]) return false; - otherString = object; + string = object; length = self.length; - if (otherString.length != length) + if (string.length != length) return false; pool = objc_autoreleasePoolPush(); characters = self.characters; - otherCharacters = otherString.characters; + otherCharacters = string.characters; if (memcmp(characters, otherCharacters, length * sizeof(of_unichar_t)) != 0) { objc_autoreleasePoolPop(pool); return false; @@ -1554,31 +1554,29 @@ - (id)mutableCopy { return [[OFMutableString alloc] initWithString: self]; } -- (of_comparison_result_t)compare: (id )object +- (of_comparison_result_t)compare: (OFString *)string { void *pool; - OFString *otherString; const of_unichar_t *characters, *otherCharacters; size_t minimumLength; - if (object == self) + if (string == self) return OF_ORDERED_SAME; - if (![(id)object isKindOfClass: [OFString class]]) + if (![string isKindOfClass: [OFString class]]) @throw [OFInvalidArgumentException exception]; - otherString = (OFString *)object; - minimumLength = (self.length > otherString.length - ? otherString.length : self.length); + minimumLength = (self.length > string.length + ? string.length : self.length); pool = objc_autoreleasePoolPush(); characters = self.characters; - otherCharacters = otherString.characters; + otherCharacters = string.characters; for (size_t i = 0; i < minimumLength; i++) { if (characters[i] > otherCharacters[i]) { objc_autoreleasePoolPop(pool); return OF_ORDERED_DESCENDING; @@ -1590,31 +1588,31 @@ } } objc_autoreleasePoolPop(pool); - if (self.length > otherString.length) + if (self.length > string.length) return OF_ORDERED_DESCENDING; - if (self.length < otherString.length) + if (self.length < string.length) return OF_ORDERED_ASCENDING; return OF_ORDERED_SAME; } -- (of_comparison_result_t)caseInsensitiveCompare: (OFString *)otherString +- (of_comparison_result_t)caseInsensitiveCompare: (OFString *)string { void *pool = objc_autoreleasePoolPush(); const of_unichar_t *characters, *otherCharacters; size_t length, otherLength, minimumLength; - if (otherString == self) + if (string == self) return OF_ORDERED_SAME; characters = self.characters; - otherCharacters = otherString.characters; + otherCharacters = string.characters; length = self.length; - otherLength = otherString.length; + otherLength = string.length; minimumLength = (length > otherLength ? otherLength : length); for (size_t i = 0; i < minimumLength; i++) { of_unichar_t c = characters[i]; Index: src/OFTimer.m ================================================================== --- src/OFTimer.m +++ src/OFTimer.m @@ -504,18 +504,14 @@ #endif [super dealloc]; } -- (of_comparison_result_t)compare: (id )object -{ - OFTimer *timer; - - if (![(id)object isKindOfClass: [OFTimer class]]) - @throw [OFInvalidArgumentException exception]; - - timer = (OFTimer *)object; +- (of_comparison_result_t)compare: (OFTimer *)timer +{ + if (![timer isKindOfClass: [OFTimer class]]) + @throw [OFInvalidArgumentException exception]; return [_fireDate compare: timer->_fireDate]; } - (void)of_setInRunLoop: (OFRunLoop *)runLoop mode: (of_run_loop_mode_t)mode Index: src/OFUTF8String.m ================================================================== --- src/OFUTF8String.m +++ src/OFUTF8String.m @@ -772,54 +772,51 @@ return _s->cStringLength; } - (bool)isEqual: (id)object { - OFUTF8String *otherString; + OFUTF8String *string; if (object == self) return true; if (![object isKindOfClass: [OFString class]]) return false; - otherString = object; + string = object; - if (otherString.UTF8StringLength != _s->cStringLength || - otherString.length != _s->length) + if (string.UTF8StringLength != _s->cStringLength || + string.length != _s->length) + return false; + + if (([string isKindOfClass: [OFUTF8String class]] || + [string isKindOfClass: [OFMutableUTF8String class]]) && + _s->hashed && string->_s->hashed && _s->hash != string->_s->hash) return false; - if (([otherString isKindOfClass: [OFUTF8String class]] || - [otherString isKindOfClass: [OFMutableUTF8String class]]) && - _s->hashed && otherString->_s->hashed && - _s->hash != otherString->_s->hash) - return false; - - if (strcmp(_s->cString, otherString.UTF8String) != 0) + if (strcmp(_s->cString, string.UTF8String) != 0) return false; return true; } -- (of_comparison_result_t)compare: (id )object +- (of_comparison_result_t)compare: (OFString *)string { - OFString *otherString; size_t otherCStringLength, minimumCStringLength; int compare; - if (object == self) + if (string == self) return OF_ORDERED_SAME; - if (![(id)object isKindOfClass: [OFString class]]) + if (![string isKindOfClass: [OFString class]]) @throw [OFInvalidArgumentException exception]; - otherString = (OFString *)object; - otherCStringLength = otherString.UTF8StringLength; + otherCStringLength = string.UTF8StringLength; minimumCStringLength = (_s->cStringLength > otherCStringLength ? otherCStringLength : _s->cStringLength); - if ((compare = memcmp(_s->cString, otherString.UTF8String, + if ((compare = memcmp(_s->cString, string.UTF8String, minimumCStringLength)) == 0) { if (_s->cStringLength > otherCStringLength) return OF_ORDERED_DESCENDING; if (_s->cStringLength < otherCStringLength) return OF_ORDERED_ASCENDING; @@ -830,27 +827,24 @@ return OF_ORDERED_DESCENDING; else return OF_ORDERED_ASCENDING; } -- (of_comparison_result_t)caseInsensitiveCompare: (OFString *)otherString +- (of_comparison_result_t)caseInsensitiveCompare: (OFString *)string { const char *otherCString; size_t otherCStringLength, minimumCStringLength; #ifdef OF_HAVE_UNICODE_TABLES size_t i, j; #endif int compare; - if (otherString == self) + if (string == self) return OF_ORDERED_SAME; - if (![otherString isKindOfClass: [OFString class]]) - @throw [OFInvalidArgumentException exception]; - - otherCString = otherString.UTF8String; - otherCStringLength = otherString.UTF8StringLength; + otherCString = string.UTF8String; + otherCStringLength = string.UTF8StringLength; #ifdef OF_HAVE_UNICODE_TABLES if (!_s->isUTF8) { #endif minimumCStringLength = (_s->cStringLength > otherCStringLength Index: tests/OFInvocationTests.m ================================================================== --- tests/OFInvocationTests.m +++ tests/OFInvocationTests.m @@ -38,223 +38,10 @@ : (struct test_struct)st { return st; } -#ifdef OF_INVOCATION_CAN_INVOKE -- (void)invocationTestMethod2: (id)obj -{ - assert(obj == self); -} - -- (int)invocationTestMethod3: (int)i1 - : (int)i2 - : (int)i3 - : (int)i4 - : (int)i5 - : (int)i6 - : (int)i7 - : (int)i8 - : (int)i9 - : (int)i10 - : (int)i11 - : (int)i12 - : (int)i13 - : (int)i14 - : (int)i15 - : (int)i16 -{ - return (i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9 + i10 + i11 + - i12 + i13 + i14 + i15 + i16) / 16; -} - -- (double)invocationTestMethod4: (double)d1 - : (double)d2 - : (double)d3 - : (double)d4 - : (double)d5 - : (double)d6 - : (double)d7 - : (double)d8 - : (double)d9 - : (double)d10 - : (double)d11 - : (double)d12 - : (double)d13 - : (double)d14 - : (double)d15 - : (double)d16 -{ - return (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 + - d12 + d13 + d14 + d15 + d16) / 16; -} - -- (float)invocationTestMethod5: (double)d1 - : (float)f2 - : (float)f3 - : (float)f4 - : (float)f5 - : (float)f6 - : (float)f7 - : (float)f8 - : (float)f9 - : (double)d10 - : (float)f11 - : (float)f12 - : (float)f13 - : (float)f14 - : (float)f15 - : (float)f16 -{ - return (float)((d1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + d10 + f11 + - f12 + f13 + f14 + f15 + f16) / 16); -} - -- (long double)invocationTestMethod6: (long double)d1 - : (long double)d2 - : (long double)d3 - : (long double)d4 - : (long double)d5 - : (long double)d6 - : (long double)d7 - : (long double)d8 - : (long double)d9 - : (long double)d10 - : (long double)d11 - : (long double)d12 - : (long double)d13 - : (long double)d14 - : (long double)d15 - : (long double)d16 -{ - return (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 + - d12 + d13 + d14 + d15 + d16) / 16; -} - -# if defined(HAVE_COMPLEX_H) && !defined(__STDC_NO_COMPLEX__) -- (complex double)invocationTestMethod7: (complex float)c1 - : (complex double)c2 - : (complex float)c3 - : (complex double)c4 - : (complex float)c5 - : (complex double)c6 - : (complex float)c7 - : (complex double)c8 - : (complex float)c9 - : (complex double)c10 - : (complex float)c11 - : (complex double)c12 - : (complex float)c13 - : (complex double)c14 - : (complex float)c15 - : (complex double)c16 -{ - OF_ENSURE(creal(c1) == 1.0 && cimag(c1) == 0.5); - OF_ENSURE(creal(c2) == 2.0 && cimag(c2) == 1.0); - OF_ENSURE(creal(c3) == 3.0 && cimag(c3) == 1.5); - OF_ENSURE(creal(c4) == 4.0 && cimag(c4) == 2.0); - OF_ENSURE(creal(c5) == 5.0 && cimag(c5) == 2.5); - OF_ENSURE(creal(c6) == 6.0 && cimag(c6) == 3.0); - OF_ENSURE(creal(c7) == 7.0 && cimag(c7) == 3.5); - OF_ENSURE(creal(c8) == 8.0 && cimag(c8) == 4.0); - OF_ENSURE(creal(c9) == 9.0 && cimag(c9) == 4.5); - OF_ENSURE(creal(c10) == 10.0 && cimag(c10) == 5.0); - OF_ENSURE(creal(c11) == 11.0 && cimag(c11) == 5.5); - OF_ENSURE(creal(c12) == 12.0 && cimag(c12) == 6.0); - OF_ENSURE(creal(c13) == 13.0 && cimag(c13) == 6.5); - OF_ENSURE(creal(c14) == 14.0 && cimag(c14) == 7.0); - OF_ENSURE(creal(c15) == 15.0 && cimag(c15) == 7.5); - OF_ENSURE(creal(c16) == 16.0 && cimag(c16) == 8.0); - - return (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10 + c11 + - c12 + c13 + c14 + c15 + c16) / 16; -} - -- (complex long double)invocationTestMethod8: (complex double)c1 - : (complex float)c2 - : (complex long double)c3 - : (complex double)c4 - : (complex float)c5 - : (complex long double)c6 - : (complex double)c7 - : (complex float)c8 - : (complex long double)c9 - : (complex double)c10 - : (complex float)c11 - : (complex long double)c12 - : (complex double)c13 - : (complex float)c14 - : (complex long double)c15 - : (complex double)c16 -{ - OF_ENSURE(creal(c1) == 1.0 && cimag(c1) == 0.5); - OF_ENSURE(creal(c2) == 2.0 && cimag(c2) == 1.0); - OF_ENSURE(creal(c3) == 3.0 && cimag(c3) == 1.5); - OF_ENSURE(creal(c4) == 4.0 && cimag(c4) == 2.0); - OF_ENSURE(creal(c5) == 5.0 && cimag(c5) == 2.5); - OF_ENSURE(creal(c6) == 6.0 && cimag(c6) == 3.0); - OF_ENSURE(creal(c7) == 7.0 && cimag(c7) == 3.5); - OF_ENSURE(creal(c8) == 8.0 && cimag(c8) == 4.0); - OF_ENSURE(creal(c9) == 9.0 && cimag(c9) == 4.5); - OF_ENSURE(creal(c10) == 10.0 && cimag(c10) == 5.0); - OF_ENSURE(creal(c11) == 11.0 && cimag(c11) == 5.5); - OF_ENSURE(creal(c12) == 12.0 && cimag(c12) == 6.0); - OF_ENSURE(creal(c13) == 13.0 && cimag(c13) == 6.5); - OF_ENSURE(creal(c14) == 14.0 && cimag(c14) == 7.0); - OF_ENSURE(creal(c15) == 15.0 && cimag(c15) == 7.5); - OF_ENSURE(creal(c16) == 16.0 && cimag(c16) == 8.0); - - return (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10 + c11 + - c12 + c13 + c14 + c15 + c16) / 16; -} -# endif - -# ifdef __SIZEOF_INT128__ -__extension__ -- (__int128)invocationTestMethod9: (int)i1 - : (__int128)i2 - : (__int128)i3 - : (__int128)i4 - : (int)i5 - : (__int128)i6 - : (__int128)i7 - : (__int128)i8 - : (__int128)i9 - : (__int128)i10 - : (__int128)i11 - : (__int128)i12 - : (__int128)i13 - : (__int128)i14 - : (__int128)i15 - : (__int128)i16 -{ - __int128 mask = (__int128)0xFFFFFFFFFFFFFFFF << 64; - - OF_ENSURE(i1 == 1); - OF_ENSURE(i2 == mask + 2); - OF_ENSURE(i3 == mask + 3); - OF_ENSURE(i4 == mask + 4); - OF_ENSURE(i5 == 5); - OF_ENSURE(i6 == mask + 6); - OF_ENSURE(i7 == mask + 7); - OF_ENSURE(i8 == mask + 8); - OF_ENSURE(i9 == mask + 9); - OF_ENSURE(i10 == mask + 10); - OF_ENSURE(i11 == mask + 11); - OF_ENSURE(i12 == mask + 12); - OF_ENSURE(i13 == mask + 13); - OF_ENSURE(i14 == mask + 14); - OF_ENSURE(i15 == mask + 15); - OF_ENSURE(i16 == mask + 16); - - return ((i1 + (int)i2 + (int)i3 + (int)i4 + i5 + (int)i6 + (int)i7 + - (int)i8 + (int)i9 + (int)i10 + (int)i11 + (int)i12 + (int)i13 + - (int)i14 + (int)i15 + (int)i16) / 16) + mask; -} -# endif -#endif - - (void)invocationTests { void *pool = objc_autoreleasePoolPush(); SEL selector = @selector(invocationTestMethod1::::); OFMethodSignature *sig = [self methodSignatureForSelector: selector];