@@ -77,12 +77,12 @@ [self freeMemory: data]; data = newdata; size = newsize; } -- (id)setObject: (OFObject*)obj - forKey: (OFObject *)key +- (void)setObject: (OFObject*)obj + forKey: (OFObject *)key { uint32_t i, hash, last; id old; if (key == nil || obj == nil) @@ -157,23 +157,21 @@ b->object = obj; b->hash = hash; data[i] = b; count++; - return nil; + return; } old = data[i]->object; data[i]->object = [obj retain]; - - return [old autorelease]; + [old release]; } -- (id)removeObjectForKey: (OFObject*)key +- (void)removeObjectForKey: (OFObject*)key { uint32_t i, hash, last; - id old; if (key == nil) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; @@ -183,50 +181,46 @@ for (i = hash & (size - 1); i < last && data[i] != NULL; i++) { if (data[i] == DELETED) continue; if ([data[i]->key isEqual: key]) { - old = data[i]->object; - [data[i]->key release]; + [data[i]->object release]; [self freeMemory: data[i]]; data[i] = DELETED; count--; mutations++; [self _resizeForCount: count]; - return [old autorelease]; + return; } } if (i < last) - return nil; + return; /* In case the last bucket is already used */ last = hash & (size - 1); for (i = 0; i < last && data[i] != NULL; i++) { if (data[i] == DELETED) continue; if ([data[i]->key isEqual: key]) { - old = data[i]->object; - [data[i]->key release]; + [data[i]->object release]; [self freeMemory: data[i]]; data[i] = DELETED; count--; mutations++; [self _resizeForCount: count]; - return [old autorelease]; + return; } } - - return nil; } - copy { return [[OFDictionary alloc] initWithDictionary: self];