mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
zeroing weak key fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28236 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
04fc6f6d68
commit
c15de5f481
3 changed files with 7 additions and 3 deletions
|
@ -804,13 +804,13 @@ static INLINE GSIMapNode
|
|||
GSIMapEnumeratorNextNode(GSIMapEnumerator enumerator)
|
||||
{
|
||||
GSIMapNode node = ((_GSIE)enumerator)->node;
|
||||
GSIMapTable map = ((_GSIE)enumerator)->map;
|
||||
|
||||
#if GS_WITH_GC
|
||||
/* Find the frst available non-zeroed node.
|
||||
*/
|
||||
if (node != 0 && GSI_MAP_ZEROED(map) && node->key.addr == 0)
|
||||
{
|
||||
GSIMapTable map = ((_GSIE)enumerator)->map;
|
||||
size_t bucketCount = map->bucketCount;
|
||||
size_t bucket = ((_GSIE)enumerator)->bucket;
|
||||
|
||||
|
@ -838,7 +838,6 @@ GSIMapEnumeratorNextNode(GSIMapEnumerator enumerator)
|
|||
#if GS_WITH_GC
|
||||
if (GSI_MAP_ZEROED(map))
|
||||
{
|
||||
GSIMapTable map = ((_GSIE)enumerator)->map;
|
||||
size_t bucket = ((_GSIE)enumerator)->bucket;
|
||||
|
||||
while (next != 0 && next->key.addr == 0)
|
||||
|
@ -850,7 +849,6 @@ GSIMapEnumeratorNextNode(GSIMapEnumerator enumerator)
|
|||
|
||||
if (next == 0)
|
||||
{
|
||||
GSIMapTable map = ((_GSIE)enumerator)->map;
|
||||
size_t bucketCount = map->bucketCount;
|
||||
size_t bucket = ((_GSIE)enumerator)->bucket;
|
||||
|
||||
|
|
|
@ -87,6 +87,9 @@ typedef GSIMapNode_t *GSIMapNode;
|
|||
#define GSI_MAP_RETAIN_KEY(M, X)\
|
||||
(M->legacy ? M->cb.old.retain(M, X.ptr) \
|
||||
: pointerFunctionsAcquire(&M->cb.pf, &X.ptr, X.ptr))
|
||||
#define GSI_MAP_ZEROED(M)\
|
||||
(M->legacy ? 0 \
|
||||
: ((M->cb.pf.options & NSPointerFunctionsZeroingWeakMemory) ? YES : NO))
|
||||
|
||||
#define GSI_MAP_ENUMERATOR NSHashEnumerator
|
||||
|
||||
|
|
|
@ -97,6 +97,9 @@ typedef GSIMapNode_t *GSIMapNode;
|
|||
#define GSI_MAP_RETAIN_VAL(M, X)\
|
||||
(M->legacy ? M->cb.old.v.retain(M, X.ptr) \
|
||||
: pointerFunctionsAcquire(&M->cb.pf.v, &X.ptr, X.ptr))
|
||||
#define GSI_MAP_ZEROED(M)\
|
||||
(M->legacy ? 0 \
|
||||
: ((M->cb.pf.k.options & NSPointerFunctionsZeroingWeakMemory) ? YES : NO))
|
||||
|
||||
#define GSI_MAP_ENUMERATOR NSMapEnumerator
|
||||
|
||||
|
|
Loading…
Reference in a new issue