mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 17:12:03 +00:00
Don't define macros that are already defined.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4276 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d78c8a8c86
commit
c0eaedb49a
2 changed files with 45 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Fri May 21 9:56:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
|
* Source/include/NSObject.h: Bracket macro definitions with #ifndef
|
||||||
|
in case they are already defined.
|
||||||
|
|
||||||
Thu May 20 20:30:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
Thu May 20 20:30:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
* Source/NSUserDefaults.m: Don't load defaults unless we need to.
|
* Source/NSUserDefaults.m: Don't load defaults unless we need to.
|
||||||
|
|
|
@ -226,41 +226,74 @@ extern NSRecursiveLock *gnustep_global_lock;
|
||||||
#endif
|
#endif
|
||||||
#if GS_WITH_GC
|
#if GS_WITH_GC
|
||||||
|
|
||||||
|
#ifndef RETAIN
|
||||||
#define RETAIN(object) ((id)object)
|
#define RETAIN(object) ((id)object)
|
||||||
|
#endif
|
||||||
|
#ifndef RELEASE
|
||||||
#define RELEASE(object)
|
#define RELEASE(object)
|
||||||
|
#endif
|
||||||
|
#ifndef AUTORELEASE
|
||||||
#define AUTORELEASE(object) ((id)object)
|
#define AUTORELEASE(object) ((id)object)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TEST_RETAIN
|
||||||
#define TEST_RETAIN(object) ((id)object)
|
#define TEST_RETAIN(object) ((id)object)
|
||||||
|
#endif
|
||||||
|
#ifndef TEST_RELEASE
|
||||||
#define TEST_RELEASE(object)
|
#define TEST_RELEASE(object)
|
||||||
|
#endif
|
||||||
|
#ifndef TEST_AUTORELEASE
|
||||||
#define TEST_AUTORELEASE(object) ((id)object)
|
#define TEST_AUTORELEASE(object) ((id)object)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ASSIGN
|
||||||
#define ASSIGN(object,value) (object = value)
|
#define ASSIGN(object,value) (object = value)
|
||||||
|
#endif
|
||||||
|
#ifndef ASSIGNCOPY
|
||||||
#define ASSIGNCOPY(object,value) (object = [value copy])
|
#define ASSIGNCOPY(object,value) (object = [value copy])
|
||||||
|
#endif
|
||||||
|
#ifndef DESTROY
|
||||||
#define DESTROY(object) (object = nil)
|
#define DESTROY(object) (object = nil)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CREATE_AUTORELEASE_POOL
|
||||||
#define CREATE_AUTORELEASE_POOL(X)
|
#define CREATE_AUTORELEASE_POOL(X)
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Basic retain, release, and autorelease operations.
|
* Basic retain, release, and autorelease operations.
|
||||||
*/
|
*/
|
||||||
|
#ifndef RETAIN
|
||||||
#define RETAIN(object) [object retain]
|
#define RETAIN(object) [object retain]
|
||||||
|
#endif
|
||||||
|
#ifndef RELEASE
|
||||||
#define RELEASE(object) [object release]
|
#define RELEASE(object) [object release]
|
||||||
|
#endif
|
||||||
|
#ifndef AUTORELEASE
|
||||||
#define AUTORELEASE(object) [object autorelease]
|
#define AUTORELEASE(object) [object autorelease]
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tested retain, release, and autorelease operations - only invoke the
|
* Tested retain, release, and autorelease operations - only invoke the
|
||||||
* objective-c method if the receiver is not nil.
|
* objective-c method if the receiver is not nil.
|
||||||
*/
|
*/
|
||||||
|
#ifndef TEST_RETAIN
|
||||||
#define TEST_RETAIN(object) (object != nil ? [object retain] : nil)
|
#define TEST_RETAIN(object) (object != nil ? [object retain] : nil)
|
||||||
|
#endif
|
||||||
|
#ifndef TEST_RELEASE
|
||||||
#define TEST_RELEASE(object) ({ if (object) [object release]; })
|
#define TEST_RELEASE(object) ({ if (object) [object release]; })
|
||||||
|
#endif
|
||||||
|
#ifndef TEST_AUTORELEASE
|
||||||
#define TEST_AUTORELEASE(object) ({ if (object) [object autorelease]; })
|
#define TEST_AUTORELEASE(object) ({ if (object) [object autorelease]; })
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ASSIGN(object,value) assignes the value to the object with
|
* ASSIGN(object,value) assignes the value to the object with
|
||||||
* appropriate retain and release operations.
|
* appropriate retain and release operations.
|
||||||
*/
|
*/
|
||||||
|
#ifndef ASSIGN
|
||||||
#define ASSIGN(object,value) ({\
|
#define ASSIGN(object,value) ({\
|
||||||
typeof (value) __value = (value); \
|
typeof (value) __value = (value); \
|
||||||
if (__value != object) \
|
if (__value != object) \
|
||||||
|
@ -276,11 +309,13 @@ if (__value != object) \
|
||||||
object = __value; \
|
object = __value; \
|
||||||
} \
|
} \
|
||||||
})
|
})
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ASSIGNCOPY(object,value) assignes a copy of the value to the object with
|
* ASSIGNCOPY(object,value) assignes a copy of the value to the object with
|
||||||
* and release operations.
|
* and release operations.
|
||||||
*/
|
*/
|
||||||
|
#ifndef ASSIGNCOPY
|
||||||
#define ASSIGNCOPY(object,value) ({\
|
#define ASSIGNCOPY(object,value) ({\
|
||||||
typeof (value) __value = (value); \
|
typeof (value) __value = (value); \
|
||||||
if (__value != object) \
|
if (__value != object) \
|
||||||
|
@ -296,12 +331,14 @@ if (__value != object) \
|
||||||
object = __value; \
|
object = __value; \
|
||||||
} \
|
} \
|
||||||
})
|
})
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DESTROY() is a release operation which also sets the object to be
|
* DESTROY() is a release operation which also sets the object to be
|
||||||
* a nil pointer for tidyness - we can't accidentally use a DESTROYED
|
* a nil pointer for tidyness - we can't accidentally use a DESTROYED
|
||||||
* object later.
|
* object later.
|
||||||
*/
|
*/
|
||||||
|
#ifndef DESTROY
|
||||||
#define DESTROY(object) ({ \
|
#define DESTROY(object) ({ \
|
||||||
if (object) \
|
if (object) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -309,9 +346,12 @@ if (__value != object) \
|
||||||
object = nil; \
|
object = nil; \
|
||||||
} \
|
} \
|
||||||
})
|
})
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CREATE_AUTORELEASE_POOL
|
||||||
#define CREATE_AUTORELEASE_POOL(X) \
|
#define CREATE_AUTORELEASE_POOL(X) \
|
||||||
NSAutoreleasePool *(X) = [NSAutoreleasePool new]
|
NSAutoreleasePool *(X) = [NSAutoreleasePool new]
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue