From 062a995fe73f389e5b2fd0472907a00e146d0af3 Mon Sep 17 00:00:00 2001 From: mccallum Date: Tue, 16 Apr 1996 02:52:13 +0000 Subject: [PATCH] ([NSGDictionaryObjectEnumerator -nextObject]): Return the key, not the object. ([NSGDictionary -objectForKey:]): Method moved from NSGMutableDictionary. ([NSGMutableDictionary +initialize]): Don't use static variable in test. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1370 72102866-910b-0410-8b05-ffd578937521 --- Source/NSGDictionary.m | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/Source/NSGDictionary.m b/Source/NSGDictionary.m index c797809d2..34537d79b 100644 --- a/Source/NSGDictionary.m +++ b/Source/NSGDictionary.m @@ -49,7 +49,8 @@ - nextObject { id k; - return [dictionary nextObjectAndKey: &k withEnumState: &enum_state]; + [dictionary nextObjectAndKey: &k withEnumState: &enum_state]; + return k; } - (void) dealloc @@ -80,7 +81,14 @@ + (void) initialize { if (self == [NSGDictionary class]) - class_add_behavior([NSGDictionary class], [Dictionary class]); + behavior_class_add_class (self, [Dictionary class]); +} + +- objectForKey: aKey +{ + /* xxx Should I change the method name in Dictionary? + I don't really want to; I think "at" is better. */ + return [self objectAtKey: aKey]; } /* @@ -99,12 +107,8 @@ + (void) initialize { - static int done = 0; - if (!done) - { - done = 1; - class_add_behavior([NSGMutableDictionary class], [NSGDictionary class]); - } + if (self == [NSGMutableDictionary class]) + behavior_class_add_class (self, [NSGDictionary class]); } /* This is the designated initializer */ @@ -117,13 +121,6 @@ [self putObject: anObject atKey: aKey]; } -- objectForKey: aKey -{ - /* xxx Should I change the method name in Dictionary? - I don't really want to; I think "at" is better. */ - return [self objectAtKey: aKey]; -} - - (void) removeObjectForKey:(NSString *)aKey { [self removeObjectAtKey: aKey];