mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 02:01:03 +00:00
(shallowCopyAs:, emptyCopyAs:, copyAs:): Change arg type to (Class).
(dealloc, empty): Don't use safe version of makeObjectsPerform:. (_empty, _collectionDealloc): Move to a category. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@172 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
450d5226fd
commit
08ae06a62c
1 changed files with 25 additions and 13 deletions
|
@ -67,7 +67,10 @@
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
// ?;
|
if (CONTAINS_OBJECTS)
|
||||||
|
[self makeObjectsPerform:@selector(release)];
|
||||||
|
/* xxx This used to be "safeMakeObjectsPerform:" */
|
||||||
|
[self _collectionDealloc];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +78,9 @@
|
||||||
- empty
|
- empty
|
||||||
{
|
{
|
||||||
if (CONTAINS_OBJECTS)
|
if (CONTAINS_OBJECTS)
|
||||||
[self safeMakeObjectsPerform:@selector(release)];
|
[self makeObjectsPerform:@selector(release)];
|
||||||
[self empty];
|
/* xxx This used to be "safeMakeObjectsPerform:" */
|
||||||
|
[self _empty];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,14 +259,6 @@
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This must work without sending any messages to content objects.
|
|
||||||
Content objects already may be dealloc'd when this is executed. */
|
|
||||||
- _empty
|
|
||||||
{
|
|
||||||
[self subclassResponsibility:_cmd];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TESTING;
|
// TESTING;
|
||||||
|
|
||||||
- (BOOL) isEmpty
|
- (BOOL) isEmpty
|
||||||
|
@ -570,7 +566,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// the copy to be filled by -shallowCopyAs: etc... ;
|
// the copy to be filled by -shallowCopyAs: etc... ;
|
||||||
- emptyCopyAs: (id <Collecting>)aCollectionClass
|
- emptyCopyAs: (Class)aCollectionClass
|
||||||
{
|
{
|
||||||
if (aCollectionClass == [self species])
|
if (aCollectionClass == [self species])
|
||||||
return [self emptyCopy];
|
return [self emptyCopy];
|
||||||
|
@ -584,7 +580,7 @@
|
||||||
return [self shallowCopyAs:[self species]];
|
return [self shallowCopyAs:[self species]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- shallowCopyAs: (id <Collecting>)aCollectionClass
|
- shallowCopyAs: (Class)aCollectionClass
|
||||||
{
|
{
|
||||||
id newColl = [self emptyCopyAs:aCollectionClass];
|
id newColl = [self emptyCopyAs:aCollectionClass];
|
||||||
[newColl addContentsOf:self];
|
[newColl addContentsOf:self];
|
||||||
|
@ -1315,3 +1311,19 @@ for info about latest version.",
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@implementation Collection (DeallocationHelpers)
|
||||||
|
|
||||||
|
/* This must work without sending any messages to content objects.
|
||||||
|
Content objects already may be dealloc'd when this is executed. */
|
||||||
|
- _empty
|
||||||
|
{
|
||||||
|
[self subclassResponsibility:_cmd];
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) _collectionDealloc
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
Loading…
Reference in a new issue