zeroing weak memory is now treated as weak memory since GC has been dropped

This commit is contained in:
rfm 2024-07-21 09:46:33 +01:00
parent d2fec6b222
commit 5699959d39

View file

@ -186,13 +186,24 @@ relinquishRetainedMemory(const void *item,
DESTROY(self);\ DESTROY(self);\
}) })
_x.options = options; if (memoryType(options, NSPointerFunctionsZeroingWeakMemory))
{
/* Garbage Collection is no longer supported, so we treat all weak
* memory the same way.
*/
_x.options = (options & 0xffffff00) | NSPointerFunctionsWeakMemory;
}
else
{
_x.options = options;
}
/* First we look at the memory management options to see which function /* First we look at the memory management options to see which function
* should be used to relinquish contents of a container with these * should be used to relinquish contents of a container with these
* options. * options.
*/ */
if (memoryType(options, NSPointerFunctionsZeroingWeakMemory)) if (memoryType(options, NSPointerFunctionsWeakMemory)
|| memoryType(options, NSPointerFunctionsZeroingWeakMemory))
{ {
_x.relinquishFunction = 0; _x.relinquishFunction = 0;
} }
@ -234,7 +245,8 @@ relinquishRetainedMemory(const void *item,
} }
else if (personalityType(options, NSPointerFunctionsObjectPointerPersonality)) else if (personalityType(options, NSPointerFunctionsObjectPointerPersonality))
{ {
if (memoryType(options, NSPointerFunctionsZeroingWeakMemory)) if (memoryType(options, NSPointerFunctionsWeakMemory)
|| memoryType(options, NSPointerFunctionsZeroingWeakMemory))
{ {
_x.acquireFunction = 0; _x.acquireFunction = 0;
} }
@ -284,7 +296,8 @@ relinquishRetainedMemory(const void *item,
} }
else /* objects */ else /* objects */
{ {
if (memoryType(options, NSPointerFunctionsZeroingWeakMemory)) if (memoryType(options, NSPointerFunctionsWeakMemory)
|| memoryType(options, NSPointerFunctionsZeroingWeakMemory))
{ {
_x.acquireFunction = 0; _x.acquireFunction = 0;
} }