@@ -587,10 +587,13 @@ } - (BOOL)isEqual: (id)object { OFString_UTF8 *otherString; + + if (object == self) + return YES; if (![object isKindOfClass: [OFString class]]) return NO; otherString = object; @@ -609,10 +612,13 @@ { OFString *otherString; size_t otherCStringLength, minimumCStringLength; int compare; + if (object == self) + return OF_ORDERED_SAME; + if (![object isKindOfClass: [OFString class]]) @throw [OFInvalidArgumentException exceptionWithClass: isa selector: _cmd]; otherString = object; @@ -638,10 +644,13 @@ - (of_comparison_result_t)caseInsensitiveCompare: (OFString*)otherString { const char *otherCString; size_t i, j, otherCStringLength, minimumCStringLength; int compare; + + if (otherString == self) + return OF_ORDERED_SAME; if (![otherString isKindOfClass: [OFString class]]) @throw [OFInvalidArgumentException exceptionWithClass: isa selector: _cmd];