Fix swizzle

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28222 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-04-15 08:31:14 +00:00
parent edac807d27
commit d3398a8044

View file

@ -523,37 +523,6 @@ GSIsFinalizable(Class c)
return NO;
}
void
GSPrivateSwizzle(id o, Class c)
{
if (o->class_pointer != c)
{
#if GS_WITH_GC
/* We only do allocation counting for objects that can be
* finalised - for other objects we have no way of decrementing
* the count when the object is collected.
*/
if (GSIsFinalizable(o->class_pointer))
{
/* Already finalizable, so we just need to do any allocation
* accounting.
*/
AREM(o->class_pointer, o);
AADD(c, o);
}
else if (GSIsFinalizable(c))
{
/* New clas is finalizable, so we must register the instance
* for finalisation and do allocation acounting for it.
*/
AADD(c, o);
GC_REGISTER_FINALIZER (o, GSFinalize, NULL, NULL, NULL);
}
#endif /* GS_WITH_GC */
o->class_pointer = c;
}
}
inline NSObject *
NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone)
{
@ -666,6 +635,39 @@ NSDeallocateObject(NSObject *anObject)
#endif /* GS_WITH_GC */
void
GSPrivateSwizzle(id o, Class c)
{
if (o->class_pointer != c)
{
#if GS_WITH_GC
/* We only do allocation counting for objects that can be
* finalised - for other objects we have no way of decrementing
* the count when the object is collected.
*/
if (GSIsFinalizable(o->class_pointer))
{
/* Already finalizable, so we just need to do any allocation
* accounting.
*/
AREM(o->class_pointer, o);
AADD(c, o);
}
else if (GSIsFinalizable(c))
{
/* New clas is finalizable, so we must register the instance
* for finalisation and do allocation acounting for it.
*/
AADD(c, o);
GC_REGISTER_FINALIZER (o, GSFinalize, NULL, NULL, NULL);
}
#endif /* GS_WITH_GC */
o->class_pointer = c;
}
}
BOOL
NSShouldRetainWithZone (NSObject *anObject, NSZone *requestedZone)
{