mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
fix for non-fragile abi
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32501 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
278bed4da1
commit
385f9b83fc
4 changed files with 24 additions and 7 deletions
|
@ -1,3 +1,11 @@
|
|||
2011-03-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSInternal.h:
|
||||
* Source/NSDateFormatter.m:
|
||||
* Source/NSNumberFormatter.m:
|
||||
Fix for object copying in non-fragile-ivar build spotted by
|
||||
Chris Armstrong.
|
||||
|
||||
2011-03-06 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/Additions/GSObjCRuntime.m:
|
||||
|
|
|
@ -67,6 +67,9 @@
|
|||
* You use GS_CREATE_INTERNAL() in your intialiser to create the object
|
||||
* holding the internal instance variables, and GS_DESTROY_INTERNAL() to
|
||||
* get rid of that object in your -dealloc method.
|
||||
* You use GS_COPY_INTERNAL() in your implementations of -copyWithZone:
|
||||
* and -mutableCopyWithZone: in order to get the default copying behavior
|
||||
* for the internal class (a single copy of all the instance variables).
|
||||
*
|
||||
* Instance variables are referenced using the 'internal->ivar' suntax or
|
||||
* the GSIV(classname,object,ivar) macro.
|
||||
|
@ -99,11 +102,19 @@ _internal = [name ## Internal new];
|
|||
#define GS_DESTROY_INTERNAL(name) \
|
||||
if (nil != _internal) {[_internal release]; _internal = nil; }
|
||||
|
||||
/* Create a new copy of the current object's internal class and place
|
||||
* it in the destination instance. This poduces a bitwise copy, and you
|
||||
* may wish to perform further action to deepen the copy after using this
|
||||
* macro.
|
||||
* Use this only where D is a new copy of the current instance.
|
||||
*/
|
||||
#define GS_COPY_INTERNAL(D,Z) (D)->_internal = NSCopyObject(_internal, 0, (Z));
|
||||
|
||||
|
||||
#undef internal
|
||||
#define internal ((GSInternal*)_internal)
|
||||
#undef GSIVar
|
||||
#define GSIVar(X,Y) (((GSInternal*)(X->_internal))->Y)
|
||||
#define GSIVar(X,Y) (((GSInternal*)((X)->_internal))->Y)
|
||||
|
||||
#else /* GS_NONFRAGILE */
|
||||
|
||||
|
@ -116,6 +127,8 @@ if (nil != _internal) {[_internal release]; _internal = nil; }
|
|||
|
||||
#define GS_DESTROY_INTERNAL(name)
|
||||
|
||||
#define GS_COPY_INTERNAL(D,Z)
|
||||
|
||||
/* Define constant to reference internal ivars.
|
||||
*/
|
||||
#undef internal
|
||||
|
|
|
@ -160,9 +160,7 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
|
|||
IF_NO_GC(RETAIN(o->_dateFormat));
|
||||
if (0 != internal)
|
||||
{
|
||||
o->GS_CREATE_INTERNAL(NSDateFormatter)
|
||||
|
||||
memcpy(o->_internal, internal, sizeof(NSDateFormatterInternal));
|
||||
GS_COPY_INTERNAL(o, zone)
|
||||
IF_NO_GC(RETAIN(GSIVar(o,_locale));)
|
||||
#if GS_USE_ICU == 1
|
||||
{
|
||||
|
|
|
@ -303,9 +303,7 @@ static NSUInteger _defaultBehavior = NSNumberFormatterBehavior10_4;
|
|||
IF_NO_GC(RETAIN(o->_attributedStringForZero);)
|
||||
if (0 != internal)
|
||||
{
|
||||
o->_internal = GS_CREATE_INTERNAL(NSNumberFormatter)
|
||||
|
||||
memcpy(o->_internal, internal, sizeof(NSNumberFormatterInternal));
|
||||
GS_COPY_INTERNAL(o, zone)
|
||||
IF_NO_GC(RETAIN(GSIVar(o,_locale));)
|
||||
#if GS_USE_ICU == 1
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue