From ec661068c7894006b399a5b3954d7548aee19d1b Mon Sep 17 00:00:00 2001 From: rfm Date: Mon, 19 Mar 2007 10:42:16 +0000 Subject: [PATCH] Fix documentatiion errors. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24897 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSDictionary.m | 20 ++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b90e988c..f5180572f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-19 Richard Frith-Macdonald + + * Source/NSDictionary.m: Correct errors in documentation about keys + being retained when they are in fact copied. + 2007-03-17 Adam Fedor * config/config.trampoline.c: Check for proper CPU macro for Darwin diff --git a/Source/NSDictionary.m b/Source/NSDictionary.m index b44deb26a..2d82c28c0 100644 --- a/Source/NSDictionary.m +++ b/Source/NSDictionary.m @@ -87,10 +87,11 @@ static SEL appSel; * retrieve multiple entries simultaneously, obtain sorted contents, and * read/write from/to a serialized representation.

* - *

Both keys and values are retained by the implementation, and released - * when either their entry is dropped or the entire dictionary is deallocated. - * This differs from the implementation on OS X, where keys are copied instead - * of being retained and must therefore implement the [(NSCopying)] protocol. + *

The keys are copied and values are retained by the implementation, + * and both are released when either their entry is dropped or the entire + * dictionary is deallocated.
+ * As in the OS X implementation, keys must therefore implement the + * [(NSCopying)] protocol. *

* *

Objects of this class are immutable. For a mutable version, use the @@ -507,7 +508,10 @@ static SEL appSel; /** * Initialise dictionary with the keys and values of otherDictionary. * If the shouldCopy flag is YES then the values are copied into the - * newly initialised dictionary, otherwise they are simply retained. + * newly initialised dictionary, otherwise they are simply retained, + * on the assumption that it is safe to retain the keys from another + * dictionary since that other dictionary mwill have copied the keys + * originally to ensure that they are immutable. */ - (id) initWithDictionary: (NSDictionary*)other copyItems: (BOOL)shouldCopy @@ -1155,9 +1159,9 @@ compareIt(id o1, id o2, void* context) /** * Adds entry for aKey, mapping to anObject. If either is nil, an exception * is raised. If aKey already in dictionary, the value it maps to is - * silently replaced. aKey and anObject are both retained. (This differs - * from OS X, where the key is copied and must therefore implement the - * [(NSCopying)] protocol.) + * silently replaced. The value anObject is retained, but aKey is copied + * (because a dictionary key must be immutable) and must therefore implement + * the [(NSCopying)] protocol.) */ - (void) setObject: anObject forKey: (id)aKey {