diff --git a/ChangeLog b/ChangeLog index d38e04caf..628e465a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-08-11 Richard Frith-Macdonald + + * Source/NSPropertyList.m: don't escape single quotes unnecessarily. + * Source/NSObject.m: (hash) tweak performance a little. + 2004-08-07 Richard Frith-Macdonald * Source/NSPort.m (+initialize), Source/NSPortNameServer.m diff --git a/Source/NSObject.m b/Source/NSObject.m index 3a277ae60..8760a6862 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -1684,12 +1684,20 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) * Returns the hash of the receiver. Subclasses should ensure that their * implementations of this method obey the rule that if the -isEqual: method * returns YES for two instances of the class, the -hash method returns the - * same value fro both instances.
- * The default implementation returns the address of the instance. + * same value for both instances.
+ * The default implementation returns a value based on the address + * of the instance. */ - (unsigned) hash { - return (unsigned)self; + /* + * Ideally we would shift left to lose any zero bits produced by the + * alignment of the object in memory ... but that depends on the + * processor architecture and the memory allocatiion implementation. + * In the absence of detailed information, pick a reasonable value + * assuming the object will be aligned to an eight byte boundary. + */ + return (unsigned)self >> 3; } /** diff --git a/Source/NSPropertyList.m b/Source/NSPropertyList.m index 89abfda4b..ee4b81536 100644 --- a/Source/NSPropertyList.m +++ b/Source/NSPropertyList.m @@ -1258,7 +1258,6 @@ PString(NSString *obj, NSMutableData *output) case '\v': case '\f': case '\\': - case '\'' : case '"' : len += 2; break; @@ -1301,7 +1300,6 @@ PString(NSString *obj, NSMutableData *output) case '\v': *ptr++ = '\\'; *ptr++ = 'v'; break; case '\f': *ptr++ = '\\'; *ptr++ = 'f'; break; case '\\': *ptr++ = '\\'; *ptr++ = '\\'; break; - case '\'': *ptr++ = '\\'; *ptr++ = '\''; break; case '"' : *ptr++ = '\\'; *ptr++ = '"'; break; default: