Final batch of GC cleanups (for the forseeable future).

This commit is contained in:
rfm 2024-07-25 17:11:34 +01:00
parent b49af95359
commit 28a6e6ebbd
7 changed files with 61 additions and 43 deletions

View file

@ -1,3 +1,40 @@
2024-07-25 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Foundation/NSHashTable.h:
* Headers/Foundation/NSMapTable.h:
* Headers/Foundation/NSPointerArray.h:
* Headers/Foundation/NSPointerFunctions.h:
* Headers/Foundation/NSZone.h:
* Headers/GNUstepBase/config.h.in:
* Source/GSSocketStream.m:
* Source/GSStream.m:
* Source/NSConcreteHashTable.m:
* Source/NSConcreteMapTable.m:
* Source/NSConcretePointerFunctions.h:
* Source/NSConcretePointerFunctions.m:
* Source/NSConnection.m:
* Source/NSHashTable.m:
* Source/NSKeyedArchiver.m:
* Source/NSKeyedUnarchiver.m:
* Source/NSKeyValueObserving.m:
* Source/NSMapTable.m:
* Source/NSPointerArray.m:
* Source/NSPort.m:
* Source/NSZone.m:
* Tests/base/NSHashTable/create.m:
* Tests/base/NSHashTable/weakObjects.m:
* Tests/base/NSIndexSet/enumerateRanges.m:
* Tests/base/NSMapTable/create.m:
* Tests/base/NSMapTable/weakObjects.m:
* Tests/base/NSPointerArray/weakObjects.m:
* Tests/base/NSPointerFunctions/basic.m:
* Tests/base/NSPointerFunctions/general.m:
* Tests/base/NSPointerFunctions/TestInfo:
General fixups for pointer functions, removing obsolete (non-working)
GC related internal code. There is probably still a little of that old
stuff lurking in the internals which should be removed when found, but
the vast majority is cleaned up.
2024-07-15 Richard Frith-Macdonald <rfm@gnu.org> 2024-07-15 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Foundation/NSPointerFunctions.h: deprecate GC methods. * Headers/Foundation/NSPointerFunctions.h: deprecate GC methods.

View file

@ -66,16 +66,12 @@ GS_EXPORT_CLASS
+ (instancetype) hashTableWithOptions: (NSPointerFunctionsOptions)options; + (instancetype) hashTableWithOptions: (NSPointerFunctionsOptions)options;
+ (instancetype) hashTableWithWeakObjects; /** Creates a hash table that uses weak references (using the automatic
/** * reference counting mechanism) so that objects are removed when
* Creates a hash table that uses zeroing weak references (either using the
* automatic reference counting or garbage collection mechanism, depending on
* which mode this framework is compiled in) so that objects are removed when
* their last other reference disappears. * their last other reference disappears.
*/ */
+ (instancetype) weakObjectsHashTable; + (instancetype) weakObjectsHashTable;
- (instancetype) initWithOptions: (NSPointerFunctionsOptions)options - (instancetype) initWithOptions: (NSPointerFunctionsOptions)options
capacity: (NSUInteger)initialCapacity; capacity: (NSUInteger)initialCapacity;

View file

@ -68,26 +68,6 @@ GS_EXPORT_CLASS
+ (instancetype) mapTableWithKeyOptions: (NSPointerFunctionsOptions)keyOptions + (instancetype) mapTableWithKeyOptions: (NSPointerFunctionsOptions)keyOptions
valueOptions: (NSPointerFunctionsOptions)valueOptions; valueOptions: (NSPointerFunctionsOptions)valueOptions;
/** Convenience method for creating a map table to store object values
* using object keys.
*/
+ (instancetype) mapTableWithStrongToStrongObjects;
/** Convenience method for creating a map table to store non-retained
* object values with retained object keys.
*/
+ (instancetype) mapTableWithStrongToWeakObjects;
/** Convenience method for creating a map table to store retained
* object values with non-retained object keys.
*/
+ (instancetype) mapTableWithWeakToStrongObjects;
/** Convenience method for creating a map table to store non-retained
* object values with non-retained object keys.
*/
+ (instancetype) mapTableWithWeakToWeakObjects;
/** Convenience method for creating a map table to store object values /** Convenience method for creating a map table to store object values
* using object keys. The collection will retain both the key and the value. * using object keys. The collection will retain both the key and the value.
*/ */

View file

@ -59,7 +59,7 @@ GS_EXPORT_CLASS
* objects. * objects.
*/ */
+ (id) strongObjectsPointerArray; + (id) strongObjectsPointerArray;
/** Returns a new pointer array for storing zeroing weak references to objects. /** Returns a new pointer array for storing weak references to objects.
*/ */
+ (id) weakObjectsPointerArray; + (id) weakObjectsPointerArray;

View file

@ -72,8 +72,9 @@ static Class concreteClass = 0;
+ (id) hashTableWithWeakObjects + (id) hashTableWithWeakObjects
{ {
return [self hashTableWithOptions: GSOnceMLog(@"Garbage Collection no longer supported."
NSPointerFunctionsObjectPersonality | NSPointerFunctionsWeakMemory]; @" Using +weakObjectsHashTable");
return [self weakObjectsHashTable];
} }
+ (id) weakObjectsHashTable + (id) weakObjectsHashTable

View file

@ -72,30 +72,30 @@ static Class concreteClass = 0;
+ (id) mapTableWithStrongToStrongObjects + (id) mapTableWithStrongToStrongObjects
{ {
return [self mapTableWithKeyOptions: NSPointerFunctionsObjectPersonality GSOnceMLog(@"Garbage Collection no longer supported."
valueOptions: NSPointerFunctionsObjectPersonality]; @" Using +strongToStrongObjectsMapTable");
return [self strongToStrongObjectsMapTable];
} }
+ (id) mapTableWithStrongToWeakObjects + (id) mapTableWithStrongToWeakObjects
{ {
return [self mapTableWithKeyOptions: NSPointerFunctionsObjectPersonality GSOnceMLog(@"Garbage Collection no longer supported."
valueOptions: NSPointerFunctionsObjectPersonality @" Using +strongToWeakObjectsMapTable");
| NSPointerFunctionsWeakMemory]; return [self strongToWeakObjectsMapTable];
} }
+ (id) mapTableWithWeakToStrongObjects + (id) mapTableWithWeakToStrongObjects
{ {
return [self mapTableWithKeyOptions: NSPointerFunctionsObjectPersonality GSOnceMLog(@"Garbage Collection no longer supported."
| NSPointerFunctionsWeakMemory @" Using +weakToStringObjectsMapTable");
valueOptions: NSPointerFunctionsObjectPersonality]; return [self weakToStringObjectsMapTable];
} }
+ (id) mapTableWithWeakToWeakObjects + (id) mapTableWithWeakToWeakObjects
{ {
return [self mapTableWithKeyOptions: NSPointerFunctionsObjectPersonality GSOnceMLog(@"Garbage Collection no longer supported."
| NSPointerFunctionsWeakMemory @" Using +weakToWeakObjectsMapTable");
valueOptions: NSPointerFunctionsObjectPersonality return [self weakToWeakObjectsMapTable];
| NSPointerFunctionsWeakMemory];
} }
+ (id) strongToStrongObjectsMapTable + (id) strongToStrongObjectsMapTable

View file

@ -204,12 +204,16 @@ static Class concreteClass = Nil;
+ (id) pointerArrayWithStrongObjects + (id) pointerArrayWithStrongObjects
{ {
return [self pointerArrayWithOptions: NSPointerFunctionsStrongMemory]; GSOnceMLog(@"Garbage Collection no longer supported."
@" Using +strongObjectsPointerArray");
return [self strongObjectsPointerArray];
} }
+ (id) pointerArrayWithWeakObjects + (id) pointerArrayWithWeakObjects
{ {
return [self pointerArrayWithOptions: NSPointerFunctionsWeakMemory]; GSOnceMLog(@"Garbage Collection no longer supported."
@" Using +weakObjectsPointerArray");
return [self weakObjectsPointerArray];
} }
- (NSArray*) allObjects - (NSArray*) allObjects