mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 01:01:03 +00:00
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:
parent
5c61643b94
commit
09cccdbd3e
1 changed files with 33 additions and 31 deletions
|
@ -523,37 +523,6 @@ GSIsFinalizable(Class c)
|
||||||
return NO;
|
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 *
|
inline NSObject *
|
||||||
NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone)
|
NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone)
|
||||||
{
|
{
|
||||||
|
@ -666,6 +635,39 @@ NSDeallocateObject(NSObject *anObject)
|
||||||
|
|
||||||
#endif /* GS_WITH_GC */
|
#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
|
BOOL
|
||||||
NSShouldRetainWithZone (NSObject *anObject, NSZone *requestedZone)
|
NSShouldRetainWithZone (NSObject *anObject, NSZone *requestedZone)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue