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:
Richard Frith-MacDonald 2009-09-27 18:48:03 +00:00
parent 7e156dc2cc
commit 40ee16100f
2 changed files with 11 additions and 12 deletions

View file

@ -100,14 +100,12 @@ preface.m \
mframe.m
ifeq ($(findstring openbsd, $(GNUSTEP_TARGET_OS)), openbsd)
GNU_MFILES += thr-pthread.m
OBJC_LIBS += -lpthread
endif
ifneq ($(OBJC_RUNTIME_LIB), gnu)
ifneq ($(OBJC_RUNTIME_LIB), gnugc)
GNU_MFILES += objc-gnu2next.m
GNU_MFILES += thr-pthread.m
endif
endif

View file

@ -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;
}