Minor codding improvements

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@6795 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-06-26 11:12:13 +00:00
parent bfa544a2d5
commit 060cbdf88d
4 changed files with 32 additions and 17 deletions

View file

@ -1,6 +1,8 @@
2000-06-26 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSCoder.m: Use AUTORELEASE and tidy up.
* Source/NSArchiver.m: Fix bug in ([-replaceObject:withObject:])
* Source/NSObject.m: Optimise default replacementObjectForPortCoder
2000-06-23 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -32,20 +32,20 @@
{
NSMutableData *_data; /* Data to write into. */
id _dst; /* Serialization destination. */
IMP _serImp; /* Method to serialize with. */
IMP _tagImp; /* Serialize a type tag. */
IMP _serImp; /* Method to serialize with. */
IMP _tagImp; /* Serialize a type tag. */
IMP _xRefImp; /* Serialize a crossref. */
IMP _eObjImp; /* Method to encode an id. */
IMP _eValImp; /* Method to encode others. */
#ifndef _IN_NSARCHIVER_M
#define GSIMapTable void*
#endif
GSIMapTable _clsMap; /* Class cross references. */
GSIMapTable _cIdMap; /* Conditionally coded. */
GSIMapTable _uIdMap; /* Unconditionally coded. */
GSIMapTable _ptrMap; /* Constant pointers. */
GSIMapTable _namMap; /* Mappings for class names. */
GSIMapTable _repMap; /* Mappings for objects. */
GSIMapTable _clsMap; /* Class cross references. */
GSIMapTable _cIdMap; /* Conditionally coded. */
GSIMapTable _uIdMap; /* Unconditionally coded. */
GSIMapTable _ptrMap; /* Constant pointers. */
GSIMapTable _namMap; /* Mappings for class names. */
GSIMapTable _repMap; /* Mappings for objects. */
#ifndef _IN_NSARCHIVER_M
#undef GSIMapTable
#endif

View file

@ -854,10 +854,10 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
[NSException raise: NSInternalInconsistencyException
format: @"attempt to remap object to nil"];
}
node = GSIMapNodeForKey(_namMap, (GSIMapKey)object);
node = GSIMapNodeForKey(_repMap, (GSIMapKey)object);
if (node == 0)
{
GSIMapAddPair(_namMap, (GSIMapKey)object, (GSIMapVal)newObject);
GSIMapAddPair(_repMap, (GSIMapKey)object, (GSIMapVal)newObject);
}
else
{

View file

@ -888,15 +888,28 @@ static BOOL deallocNotifications = NO;
- (id) replacementObjectForPortCoder: (NSPortCoder*)aCoder
{
if ([aCoder isBycopy]) {
return self;
static Class proxyClass = 0;
static IMP proxyImp = 0;
if (proxyImp == 0)
{
proxyClass = [NSDistantObject class];
proxyImp = [proxyClass methodForSelector:
@selector(proxyWithLocal:connection:)];
}
else if ([self isKindOfClass: [NSDistantObject class]]) {
return self;
if ([aCoder isBycopy])
{
return self;
}
else {
return [NSDistantObject proxyWithLocal: self
connection: [aCoder connection]];
else if ([self isKindOfClass: proxyClass])
{
return self;
}
else
{
return (*proxyImp)(proxyClass, @selector(proxyWithLocal:connection:),
self, [aCoder connection]);
}
}