mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Fix a few functions that I missed for hybrid mode.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33178 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
84a09a6d75
commit
ac4b932048
1 changed files with 50 additions and 27 deletions
|
@ -440,6 +440,7 @@ NSDecrementExtraRefCountWasZero(id anObject)
|
||||||
{
|
{
|
||||||
return GSDecrementExtraRefCountWasZero(anObject);
|
return GSDecrementExtraRefCountWasZero(anObject);
|
||||||
}
|
}
|
||||||
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -662,32 +663,7 @@ callCXXConstructors(Class aClass, id anObject)
|
||||||
* depending on what information (if any) we are storing before
|
* depending on what information (if any) we are storing before
|
||||||
* the start of each object.
|
* the start of each object.
|
||||||
*/
|
*/
|
||||||
#if __OBJC_GC__
|
#if GS_WITH_GC
|
||||||
|
|
||||||
inline NSZone *
|
|
||||||
GSObjCZone(NSObject *object)
|
|
||||||
{
|
|
||||||
return NSDefaultMallocZone();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline id
|
|
||||||
NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone)
|
|
||||||
{
|
|
||||||
id new = class_createInstance(aClass, extraBytes);
|
|
||||||
if (0 == cxx_construct)
|
|
||||||
{
|
|
||||||
cxx_construct = sel_registerName(".cxx_construct");
|
|
||||||
cxx_destruct = sel_registerName(".cxx_destruct");
|
|
||||||
}
|
|
||||||
callCXXConstructors(aClass, new);
|
|
||||||
return new;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void
|
|
||||||
NSDeallocateObject(id anObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#elif GS_WITH_GC
|
|
||||||
|
|
||||||
inline NSZone *
|
inline NSZone *
|
||||||
GSObjCZone(NSObject *object)
|
GSObjCZone(NSObject *object)
|
||||||
|
@ -786,6 +762,7 @@ NSDeallocateObject(id anObject)
|
||||||
|
|
||||||
#else /* GS_WITH_GC */
|
#else /* GS_WITH_GC */
|
||||||
|
|
||||||
|
#if !__OBJC_GC__
|
||||||
inline NSZone *
|
inline NSZone *
|
||||||
GSObjCZone(NSObject *object)
|
GSObjCZone(NSObject *object)
|
||||||
{
|
{
|
||||||
|
@ -794,9 +771,39 @@ GSObjCZone(NSObject *object)
|
||||||
return NSDefaultMallocZone();
|
return NSDefaultMallocZone();
|
||||||
return ((obj)object)[-1].zone;
|
return ((obj)object)[-1].zone;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __OBJC_GC__
|
||||||
|
inline NSZone *
|
||||||
|
GSObjCZone(NSObject *object)
|
||||||
|
{
|
||||||
|
return NSDefaultMallocZone();
|
||||||
|
}
|
||||||
|
static inline id
|
||||||
|
GSAllocateObject (Class aClass, NSUInteger extraBytes, NSZone *zone);
|
||||||
|
|
||||||
|
inline id
|
||||||
|
NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone)
|
||||||
|
{
|
||||||
|
if (!objc_collecting_enabled())
|
||||||
|
{
|
||||||
|
NSAllocateObject(aClass, extraBytes, zone);
|
||||||
|
}
|
||||||
|
id new = class_createInstance(aClass, extraBytes);
|
||||||
|
if (0 == cxx_construct)
|
||||||
|
{
|
||||||
|
cxx_construct = sel_registerName(".cxx_construct");
|
||||||
|
cxx_destruct = sel_registerName(".cxx_destruct");
|
||||||
|
}
|
||||||
|
callCXXConstructors(aClass, new);
|
||||||
|
return new;
|
||||||
|
}
|
||||||
|
inline id
|
||||||
|
GSAllocateObject (Class aClass, NSUInteger extraBytes, NSZone *zone)
|
||||||
|
#else
|
||||||
inline id
|
inline id
|
||||||
NSAllocateObject (Class aClass, NSUInteger extraBytes, NSZone *zone)
|
NSAllocateObject (Class aClass, NSUInteger extraBytes, NSZone *zone)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
id new;
|
id new;
|
||||||
int size;
|
int size;
|
||||||
|
@ -832,9 +839,22 @@ NSAllocateObject (Class aClass, NSUInteger extraBytes, NSZone *zone)
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
#if __OBJC_GC__
|
||||||
|
static void GSDeallocateObject(id anObject);
|
||||||
|
|
||||||
|
inline void NSDeallocateObject(id anObject)
|
||||||
|
{
|
||||||
|
if (!objc_collecting_enabled())
|
||||||
|
{
|
||||||
|
GSDeallocateObject(anObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GSDeallocateObject(id anObject)
|
||||||
|
#else
|
||||||
inline void
|
inline void
|
||||||
NSDeallocateObject(id anObject)
|
NSDeallocateObject(id anObject)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
Class aClass = object_getClass(anObject);
|
Class aClass = object_getClass(anObject);
|
||||||
|
|
||||||
|
@ -871,6 +891,9 @@ BOOL
|
||||||
NSShouldRetainWithZone (NSObject *anObject, NSZone *requestedZone)
|
NSShouldRetainWithZone (NSObject *anObject, NSZone *requestedZone)
|
||||||
{
|
{
|
||||||
#if GS_WITH_GC || __OBJC_GC__
|
#if GS_WITH_GC || __OBJC_GC__
|
||||||
|
// If we're running in hybrid mode, we disable all of the clever zone stuff
|
||||||
|
// for non-GC code, so this is always true if we're compiled for GC, even if
|
||||||
|
// we're compiled for GC but not using GC.
|
||||||
return YES;
|
return YES;
|
||||||
#else
|
#else
|
||||||
return (!requestedZone || requestedZone == NSDefaultMallocZone()
|
return (!requestedZone || requestedZone == NSDefaultMallocZone()
|
||||||
|
@ -1785,7 +1808,7 @@ objc_create_block_classes_as_subclasses_of(Class super);
|
||||||
*/
|
*/
|
||||||
- (id) autorelease
|
- (id) autorelease
|
||||||
{
|
{
|
||||||
#if !GS_WITH_GC && !__OBJC_GC__
|
#if !GS_WITH_GC
|
||||||
if (double_release_check_enabled)
|
if (double_release_check_enabled)
|
||||||
{
|
{
|
||||||
NSUInteger release_count;
|
NSUInteger release_count;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue