mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
More experimental code changes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38801 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
841ddf78e0
commit
8e93dc85d3
5 changed files with 62 additions and 9 deletions
|
@ -406,12 +406,12 @@ static GC_descr nodeDesc; // Type descriptor for map node.
|
|||
if (count > 0)
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSEnumerator *enumerator = [self keyEnumerator];
|
||||
NSObject *k;
|
||||
NSEnumerator *enumerator = [self objectEnumerator];
|
||||
NSObject *o;
|
||||
|
||||
while ((k = [enumerator nextObject]) != nil)
|
||||
while ((o = [enumerator nextObject]) != nil)
|
||||
{
|
||||
size += [k sizeInBytes: exclude];
|
||||
size += [o sizeInBytes: exclude];
|
||||
}
|
||||
[pool release];
|
||||
}
|
||||
|
|
|
@ -550,12 +550,12 @@ static Class mutableSetClass;
|
|||
if (count > 0)
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSEnumerator *enumerator = [self keyEnumerator];
|
||||
NSObject *k;
|
||||
NSEnumerator *enumerator = [self objectEnumerator];
|
||||
NSObject *o;
|
||||
|
||||
while ((k = [enumerator nextObject]) != nil)
|
||||
while ((o = [enumerator nextObject]) != nil)
|
||||
{
|
||||
size += [k sizeInBytes: exclude];
|
||||
size += [o sizeInBytes: exclude];
|
||||
}
|
||||
[pool release];
|
||||
}
|
||||
|
|
|
@ -1090,7 +1090,7 @@ tsbytes(uintptr_t s, char *buf)
|
|||
|
||||
- (NSUInteger) sizeInBytes: (NSHashTable*)exclude
|
||||
{
|
||||
if (0 == NSMapGet(exclude, self))
|
||||
if (0 == NSHashGet(exclude, self))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#import "common.h"
|
||||
|
||||
#import "Foundation/NSArray.h"
|
||||
#import "Foundation/NSAutoreleasePool.h"
|
||||
#import "Foundation/NSDictionary.h"
|
||||
#import "Foundation/NSEnumerator.h"
|
||||
#import "Foundation/NSException.h"
|
||||
|
@ -1065,6 +1066,30 @@ const NSHashTableCallBacks NSPointerToStructHashCallBacks =
|
|||
}
|
||||
}
|
||||
|
||||
- (NSUInteger) sizeInBytes: (NSHashTable*)exclude
|
||||
{
|
||||
NSUInteger size = [super sizeInBytes: exclude];
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
NSUInteger count = [self count];
|
||||
|
||||
size += GSIMapSize(self);
|
||||
if (count > 0)
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSEnumerator *enumerator = [self objectEnumerator];
|
||||
NSObject *o;
|
||||
|
||||
while ((o = [enumerator nextObject]) != nil)
|
||||
{
|
||||
size += [o sizeInBytes: exclude];
|
||||
}
|
||||
[pool release];
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSConcreteHashTableEnumerator
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#import "common.h"
|
||||
|
||||
#import "Foundation/NSArray.h"
|
||||
#import "Foundation/NSAutoreleasePool.h"
|
||||
#import "Foundation/NSDictionary.h"
|
||||
#import "Foundation/NSEnumerator.h"
|
||||
#import "Foundation/NSException.h"
|
||||
|
@ -1429,6 +1430,33 @@ const NSMapTableValueCallBacks NSOwnedPointerMapValueCallBacks =
|
|||
p->_x = self->cb.pf.v;
|
||||
return [p autorelease];
|
||||
}
|
||||
|
||||
- (NSUInteger) sizeInBytes: (NSHashTable*)exclude
|
||||
{
|
||||
NSUInteger size = [super sizeInBytes: exclude];
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
NSUInteger count = [self count];
|
||||
|
||||
size += GSIMapSize(self);
|
||||
if (count > 0)
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSEnumerator *enumerator = [self keyEnumerator];
|
||||
NSObject *k;
|
||||
|
||||
while ((k = [enumerator nextObject]) != nil)
|
||||
{
|
||||
NSObject *o = [self objectForKey: k];
|
||||
|
||||
size += [k sizeInBytes: exclude] + [o sizeInBytes: exclude];
|
||||
}
|
||||
[pool release];
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSConcreteMapTableKeyEnumerator
|
||||
|
|
Loading…
Reference in a new issue