tweaks for gnustep runtime

This commit is contained in:
rfm 2024-12-27 12:15:48 +00:00
parent 4a477aa34c
commit f6d47bade4
2 changed files with 33 additions and 13 deletions

View file

@ -63,6 +63,10 @@
#endif #endif
#endif #endif
#ifdef __GNUSTEP_RUNTIME__
# include <objc/capabilities.h>
#endif
#if defined(OBJC_CAP_ARC) #if defined(OBJC_CAP_ARC)
# include <objc/objc-arc.h> # include <objc/objc-arc.h>
#else #else

View file

@ -962,7 +962,7 @@ static NSNotificationCenter *default_center = nil;
* of our map tables - while enumerating a table, it is safe to remove * of our map tables - while enumerating a table, it is safe to remove
* the entry returned by the enumerator. * the entry returned by the enumerator.
*/ */
ENTER_POOL
lockNCTable(TABLE); lockNCTable(TABLE);
if (name == nil && object == nil) if (name == nil && object == nil)
@ -1100,6 +1100,7 @@ static NSNotificationCenter *default_center = nil;
} }
unlockNCTable(TABLE); unlockNCTable(TABLE);
LEAVE_POOL
} }
/** /**
@ -1114,17 +1115,13 @@ static NSNotificationCenter *default_center = nil;
[self removeObserver: observer name: nil object: nil]; [self removeObserver: observer name: nil object: nil];
} }
static void static Observation*
addPost(Observation **head, GSIArray a) addPost(Observation *head, GSIArray a)
{ {
Observation *p = 0; Observation *p = 0;
Observation *o = *head; Observation *o = head;
Observation *t; Observation *t;
if (0 == o)
{
return;
}
while (o != ENDOBS) while (o != ENDOBS)
{ {
t = o->next; t = o->next;
@ -1154,13 +1151,14 @@ addPost(Observation **head, GSIArray a)
} }
else else
{ {
*head = t; head = t;
} }
o->next = 0; o->next = 0;
obsFree(o); obsFree(o);
} }
o = t; o = t;
} }
return head;
} }
@ -1203,7 +1201,7 @@ addPost(Observation **head, GSIArray a)
/* Find all the observers that specified neither NAME nor OBJECT. /* Find all the observers that specified neither NAME nor OBJECT.
*/ */
addPost(&WILDCARD, a); WILDCARD = addPost(WILDCARD, a);
/* Find the observers that specified OBJECT, but didn't specify NAME. /* Find the observers that specified OBJECT, but didn't specify NAME.
*/ */
@ -1212,7 +1210,13 @@ addPost(Observation **head, GSIArray a)
n = GSIMapNodeForSimpleKey(NAMELESS, (GSIMapKey)object); n = GSIMapNodeForSimpleKey(NAMELESS, (GSIMapKey)object);
if (n) if (n)
{ {
addPost(&(n->value.ext), a); if (ENDOBS == (n->value.ext = addPost(n->value.ext, a)))
{
GSIMapBucket bucket = GSIMapBucketForKey(NAMELESS, n->key);
GSIMapRemoveNodeFromMap(NAMELESS, bucket, n);
GSIMapFreeNode(NAMELESS, n);
}
} }
} }
@ -1237,7 +1241,13 @@ addPost(Observation **head, GSIArray a)
n = GSIMapNodeForSimpleKey(m, (GSIMapKey)object); n = GSIMapNodeForSimpleKey(m, (GSIMapKey)object);
if (n != 0) if (n != 0)
{ {
addPost(&(n->value.ext), a); if (ENDOBS == (n->value.ext = addPost(n->value.ext, a)))
{
GSIMapBucket bucket = GSIMapBucketForKey(m, n->key);
GSIMapRemoveNodeFromMap(m, bucket, n);
GSIMapFreeNode(m, n);
}
} }
if (object != nil) if (object != nil)
@ -1247,7 +1257,13 @@ addPost(Observation **head, GSIArray a)
n = GSIMapNodeForSimpleKey(m, (GSIMapKey)(id)nil); n = GSIMapNodeForSimpleKey(m, (GSIMapKey)(id)nil);
if (n != 0) if (n != 0)
{ {
addPost(&(n->value.ext), a); if (ENDOBS == (n->value.ext = addPost(n->value.ext, a)))
{
GSIMapBucket bucket = GSIMapBucketForKey(m, n->key);
GSIMapRemoveNodeFromMap(m, bucket, n);
GSIMapFreeNode(m, n);
}
} }
} }
} }