Author: rfm
Date: Wed Jul 15 17:26:29 2015
New Revision: 38801

URL: http://svn.gna.org/viewcvs/gnustep?rev=38801&view=rev
Log:
More experimental code changes

Modified:
    libs/base/trunk/Source/GSCountedSet.m
    libs/base/trunk/Source/GSSet.m
    libs/base/trunk/Source/GSString.m
    libs/base/trunk/Source/NSConcreteHashTable.m
    libs/base/trunk/Source/NSConcreteMapTable.m

Modified: libs/base/trunk/Source/GSCountedSet.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/GSCountedSet.m?rev=38801&r1=38800&r2=38801&view=diff
==============================================================================
--- libs/base/trunk/Source/GSCountedSet.m       (original)
+++ libs/base/trunk/Source/GSCountedSet.m       Wed Jul 15 17:26:29 2015
@@ -406,12 +406,12 @@
       if (count > 0)
         {
          NSAutoreleasePool     *pool = [NSAutoreleasePool new];
-         NSEnumerator          *enumerator = [self keyEnumerator];
-         NSObject              *k;
-
-         while ((k = [enumerator nextObject]) != nil)
+         NSEnumerator          *enumerator = [self objectEnumerator];
+         NSObject              *o;
+
+         while ((o = [enumerator nextObject]) != nil)
            {
-             size += [k sizeInBytes: exclude];
+             size += [o sizeInBytes: exclude];
            }
          [pool release];
        }

Modified: libs/base/trunk/Source/GSSet.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/GSSet.m?rev=38801&r1=38800&r2=38801&view=diff
==============================================================================
--- libs/base/trunk/Source/GSSet.m      (original)
+++ libs/base/trunk/Source/GSSet.m      Wed Jul 15 17:26:29 2015
@@ -550,12 +550,12 @@
       if (count > 0)
         {
          NSAutoreleasePool     *pool = [NSAutoreleasePool new];
-         NSEnumerator          *enumerator = [self keyEnumerator];
-         NSObject              *k;
-
-         while ((k = [enumerator nextObject]) != nil)
-           {
-             size += [k sizeInBytes: exclude];
+         NSEnumerator          *enumerator = [self objectEnumerator];
+         NSObject              *o;
+
+         while ((o = [enumerator nextObject]) != nil)
+           {
+             size += [o sizeInBytes: exclude];
            }
          [pool release];
        }

Modified: libs/base/trunk/Source/GSString.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/GSString.m?rev=38801&r1=38800&r2=38801&view=diff
==============================================================================
--- libs/base/trunk/Source/GSString.m   (original)
+++ libs/base/trunk/Source/GSString.m   Wed Jul 15 17:26:29 2015
@@ -1090,7 +1090,7 @@
 
 - (NSUInteger) sizeInBytes: (NSHashTable*)exclude
 {
-  if (0 == NSMapGet(exclude, self))
+  if (0 == NSHashGet(exclude, self))
     {
       return 0;
     }

Modified: libs/base/trunk/Source/NSConcreteHashTable.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSConcreteHashTable.m?rev=38801&r1=38800&r2=38801&view=diff
==============================================================================
--- libs/base/trunk/Source/NSConcreteHashTable.m        (original)
+++ libs/base/trunk/Source/NSConcreteHashTable.m        Wed Jul 15 17:26:29 2015
@@ -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 @@
     }
 }
 
+- (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

Modified: libs/base/trunk/Source/NSConcreteMapTable.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSConcreteMapTable.m?rev=38801&r1=38800&r2=38801&view=diff
==============================================================================
--- libs/base/trunk/Source/NSConcreteMapTable.m (original)
+++ libs/base/trunk/Source/NSConcreteMapTable.m Wed Jul 15 17:26:29 2015
@@ -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 @@
   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


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to