further cleanup ... always use -zone method to get an object's zone ...

so people can safely write subclasses using different allocation schemes.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29847 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2010-03-05 09:30:18 +00:00
parent ded18f910d
commit 5ca5ff96ef
22 changed files with 133 additions and 108 deletions

View file

@ -525,6 +525,7 @@ NSIncrementExtraRefCount(id anObject)
inline NSZone *
GSObjCZone(NSObject *object)
{
GSOnceFLog(@"GSObjCZone() is deprecated ... use -zone instead");
/* MacOS-X 10.5 seems to return the default malloc zone if GC is enabled.
*/
return NSDefaultMallocZone();
@ -601,6 +602,7 @@ NSDeallocateObject(id anObject)
inline NSZone *
GSObjCZone(NSObject *object)
{
GSOnceFLog(@"GSObjCZone() is deprecated ... use -zone instead");
if (object_getClass(object) == NSConstantStringClass)
return NSDefaultMallocZone();
return ((obj)object)[-1].zone;
@ -636,7 +638,7 @@ NSDeallocateObject(id anObject)
if ((anObject!=nil) && CLS_ISCLASS(((id)anObject)->class_pointer))
{
obj o = &((obj)anObject)[-1];
NSZone *z = GSObjCZone(anObject);
NSZone *z = o->zone;
AREM(((id)anObject)->class_pointer, (id)anObject);
if (NSZombieEnabled == YES)
@ -701,7 +703,7 @@ NSShouldRetainWithZone (NSObject *anObject, NSZone *requestedZone)
return YES;
#else
return (!requestedZone || requestedZone == NSDefaultMallocZone()
|| GSObjCZone(anObject) == requestedZone);
|| [anObject zone] == requestedZone);
#endif
}
@ -1986,7 +1988,13 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak));
*/
- (NSZone*) zone
{
return GSObjCZone(self);
#if GS_WITH_GC
/* MacOS-X 10.5 seems to return the default malloc zone if GC is enabled.
*/
return NSDefaultMallocZone();
#else
return (((obj)self)[-1]).zone;
#endif
}
/**