Minor optimisation of hahs and improved output for old style plists.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19863 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-08-11 05:24:55 +00:00
parent 6d82d060ec
commit 885883dcbe
3 changed files with 16 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2004-08-11 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPropertyList.m: don't escape single quotes unnecessarily.
* Source/NSObject.m: (hash) tweak performance a little.
2004-08-07 Richard Frith-Macdonald <rfm@gnu.org> 2004-08-07 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPort.m (+initialize), Source/NSPortNameServer.m * Source/NSPort.m (+initialize), Source/NSPortNameServer.m

View file

@ -1684,12 +1684,20 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
* Returns the hash of the receiver. Subclasses should ensure that their * Returns the hash of the receiver. Subclasses should ensure that their
* implementations of this method obey the rule that if the -isEqual: method * 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 * returns YES for two instances of the class, the -hash method returns the
* same value fro both instances.<br /> * same value for both instances.<br />
* The default implementation returns the address of the instance. * The default implementation returns a value based on the address
* of the instance.
*/ */
- (unsigned) hash - (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;
} }
/** /**

View file

@ -1258,7 +1258,6 @@ PString(NSString *obj, NSMutableData *output)
case '\v': case '\v':
case '\f': case '\f':
case '\\': case '\\':
case '\'' :
case '"' : case '"' :
len += 2; len += 2;
break; break;
@ -1301,7 +1300,6 @@ PString(NSString *obj, NSMutableData *output)
case '\v': *ptr++ = '\\'; *ptr++ = 'v'; break; case '\v': *ptr++ = '\\'; *ptr++ = 'v'; break;
case '\f': *ptr++ = '\\'; *ptr++ = 'f'; break; case '\f': *ptr++ = '\\'; *ptr++ = 'f'; break;
case '\\': *ptr++ = '\\'; *ptr++ = '\\'; break; case '\\': *ptr++ = '\\'; *ptr++ = '\\'; break;
case '\'': *ptr++ = '\\'; *ptr++ = '\''; break;
case '"' : *ptr++ = '\\'; *ptr++ = '"'; break; case '"' : *ptr++ = '\\'; *ptr++ = '"'; break;
default: default: