mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
fixups for old openbsd system
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28749 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7e156dc2cc
commit
40ee16100f
2 changed files with 11 additions and 12 deletions
|
@ -154,24 +154,25 @@
|
|||
|
||||
- (void) setObject: (id)obj forKey: (id)key cost: (NSUInteger)num
|
||||
{
|
||||
_GSCachedObject *old = [_objects objectForKey: key];
|
||||
_GSCachedObject *oldObject = [_objects objectForKey: key];
|
||||
_GSCachedObject *newObject;
|
||||
|
||||
if (nil != old)
|
||||
if (nil != oldObject)
|
||||
{
|
||||
[self removeObjectForKey: old->key];
|
||||
[self removeObjectForKey: oldObject->key];
|
||||
}
|
||||
[self _evictObjectsToMakeSpaceForObjectWithCost: num];
|
||||
_GSCachedObject *new = [_GSCachedObject new];
|
||||
newObject = [_GSCachedObject new];
|
||||
// Retained here, released when obj is dealloc'd
|
||||
new->object = RETAIN(obj);
|
||||
new->key = RETAIN(key);
|
||||
new->cost = num;
|
||||
newObject->object = RETAIN(obj);
|
||||
newObject->key = RETAIN(key);
|
||||
newObject->cost = num;
|
||||
if ([obj conformsToProtocol: @protocol(NSDiscardableContent)])
|
||||
{
|
||||
new->isEvictable = YES;
|
||||
[_accesses addObject: new];
|
||||
newObject->isEvictable = YES;
|
||||
[_accesses addObject: newObject];
|
||||
}
|
||||
[_objects setObject: new forKey: key];
|
||||
[_objects setObject: newObject forKey: key];
|
||||
RELEASE(obj);
|
||||
_totalCost += num;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue