Rewrote NSProxy's -retain / -release to be the same as NSObject, not its own ad-hoc thing.

Added declaration of __bridge for use in non-ARC mode.

Tweaked arrayWithObjects:count: to take a const id* parameter, to avoid ARC
treating it as a write-back parameter.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33425 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
theraven 2011-06-30 14:44:58 +00:00
parent cfe8b63cbf
commit 72e4d13156
5 changed files with 27 additions and 12 deletions

View file

@ -49,7 +49,7 @@ extern "C" {
#endif
+ (id) arrayWithObject: (id)anObject;
+ (id) arrayWithObjects: (id)firstObject, ...;
+ (id) arrayWithObjects: (id*)objects count: (NSUInteger)count;
+ (id) arrayWithObjects: (const id*)objects count: (NSUInteger)count;
- (NSArray*) arrayByAddingObject: (id)anObject;
- (NSArray*) arrayByAddingObjectsFromArray: (NSArray*)anotherArray;

View file

@ -36,8 +36,13 @@ extern "C" {
{
@public
Class isa;
#if !(GS_NONFRAGILE == 1)
@private
/**
* Legacy compatibility ivar. Remove in the next ABI-breaking release.
*/
NSUInteger _retain_count;
#endif
}
+ (id) alloc;

View file

@ -270,7 +270,7 @@
#ifdef __clang__
static inline void gs_consumed(id NS_CONSUMED o) __attribute__ ((unused));
static inline void gs_consumed(id o) { return; }
static inline void gs_consumed(id NS_CONSUMED o) { return; }
#define GS_CONSUMED(O) gs_consumed(O);
#else
#define GS_CONSUMED(O)

View file

@ -262,6 +262,11 @@
# define __unsafe_unretained
# endif
#endif
#ifndef __bridge
# if !__has_feature(objc_arc)
# define __bridge
# endif
#endif
#endif /* __preface_h_OBJECTS_INCLUDE */

View file

@ -34,6 +34,14 @@
#import "Foundation/NSDistantObject.h"
#import "Foundation/NSPortCoder.h"
// Get objc_delete_weak_refs(), if it is present in the runtime.
#ifdef __GNUSTEP_RUNTIME__
#include <objc/capabilities.h>
#ifdef OBJC_CAP_ARC
#include <objc/objc-arc.h>
#endif
#endif
@class NSDistantObject;
/**
@ -447,15 +455,14 @@
*/
- (void) release
{
#if GS_WITH_GC == 0
if (_retain_count == 0)
#if (GS_WITH_GC == 0)
if (NSDecrementExtraRefCountWasZero(self))
{
# ifdef OBJC_CAP_ARC
objc_delete_weak_refs(self);
# endif
[self dealloc];
}
else
{
_retain_count--;
}
#endif
}
@ -518,9 +525,7 @@
*/
- (id) retain
{
#if GS_WITH_GC == 0
_retain_count++;
#endif
NSIncrementExtraRefCount(self);
return self;
}
@ -529,7 +534,7 @@
*/
- (NSUInteger) retainCount
{
return _retain_count + 1;
return NSExtraRefCount(self) + 1;
}
/**