mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +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
339160af5a
commit
3bd97746b3
1 changed files with 25 additions and 13 deletions
|
@ -67,7 +67,10 @@
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
// ?;
|
||||
if (CONTAINS_OBJECTS)
|
||||
[self makeObjectsPerform:@selector(release)];
|
||||
/* xxx This used to be "safeMakeObjectsPerform:" */
|
||||
[self _collectionDealloc];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -75,8 +78,9 @@
|
|||
- empty
|
||||
{
|
||||
if (CONTAINS_OBJECTS)
|
||||
[self safeMakeObjectsPerform:@selector(release)];
|
||||
[self empty];
|
||||
[self makeObjectsPerform:@selector(release)];
|
||||
/* xxx This used to be "safeMakeObjectsPerform:" */
|
||||
[self _empty];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -255,14 +259,6 @@
|
|||
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;
|
||||
|
||||
- (BOOL) isEmpty
|
||||
|
@ -570,7 +566,7 @@
|
|||
}
|
||||
|
||||
// the copy to be filled by -shallowCopyAs: etc... ;
|
||||
- emptyCopyAs: (id <Collecting>)aCollectionClass
|
||||
- emptyCopyAs: (Class)aCollectionClass
|
||||
{
|
||||
if (aCollectionClass == [self species])
|
||||
return [self emptyCopy];
|
||||
|
@ -584,7 +580,7 @@
|
|||
return [self shallowCopyAs:[self species]];
|
||||
}
|
||||
|
||||
- shallowCopyAs: (id <Collecting>)aCollectionClass
|
||||
- shallowCopyAs: (Class)aCollectionClass
|
||||
{
|
||||
id newColl = [self emptyCopyAs:aCollectionClass];
|
||||
[newColl addContentsOf:self];
|
||||
|
@ -1315,3 +1311,19 @@ for info about latest version.",
|
|||
|
||||
@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