bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GDL2][Commit] EOEntity -addRelationship: update _relationshipsByName


From: David Ayers
Subject: [GDL2][Commit] EOEntity -addRelationship: update _relationshipsByName
Date: Mon, 05 May 2003 19:26:26 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312

Hi,

fixed as reported by Dirk Lattermann:
http://mail.gnu.org/archive/html/bug-gnustep/2003-05/msg00015.html

      * EOAccess/EOEntity.m: Replaced autorelease with AUTORELEASE.
      ([EOEntity -addRelationship:]): Update _relationshipByName cache.


Cheers,
Dave
? config.h
? config.log
? config.status
? gdl2.make
? gdl2.patch
? EOAccess/shared_obj
? EOAdaptors/GNUmakefile
? EOAdaptors/Postgres95/GNUmakefile
? EOAdaptors/Postgres95/Makefile.preamble
? EOAdaptors/Postgres95/Postgres95EOAdaptor.framework
? EOAdaptors/Postgres95/derived_src
? EOAdaptors/Postgres95/shared_obj
? EOControl/shared_obj
? EOModeler/shared_obj
? Tools/shared_obj
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnustep/gnustep/dev-libs/gdl2/ChangeLog,v
retrieving revision 1.50
diff -u -r1.50 ChangeLog
--- ChangeLog   2 May 2003 17:00:23 -0000       1.50
+++ ChangeLog   5 May 2003 16:19:35 -0000
@@ -1,3 +1,8 @@
+2003-05-05  David Ayers  <d.ayers@inode.at>
+
+       * EOAccess/EOEntity.m: Replaced autorelease with AUTORELEASE.
+       ([EOEntity -addRelationship:]): Update _relationshipByName cache.
+
 2003-05-02  David Ayers  <d.ayers@inode.at>
 
        * EOControl/EOKeyValueCoding.h: Use base/Foundation
Index: EOAccess/EOEntity.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/dev-libs/gdl2/EOAccess/EOEntity.m,v
retrieving revision 1.16
diff -u -r1.16 EOEntity.m
--- EOAccess/EOEntity.m 31 Mar 2003 00:24:14 -0000      1.16
+++ EOAccess/EOEntity.m 5 May 2003 16:19:36 -0000
@@ -1,7 +1,7 @@
 /**
    EOEntity.m <title>EOEntity Class</title>
 
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
 
    Author: Mirko Viviani <mirko.viviani@rccr.cremona.it>
    Date: February 2000
@@ -91,14 +91,14 @@
 
 + (EOEntity *)entity
 {
-  return [[[self alloc] init] autorelease];
+  return AUTORELEASE([[self alloc] init]);
 }
 
 + (EOEntity *)entityWithPropertyList: (NSDictionary *)propertyList
                               owner: (id)owner
 {
-  return [[[self alloc] initWithPropertyList: propertyList
-                       owner: owner] autorelease];
+  return AUTORELEASE([[self alloc] initWithPropertyList: propertyList
+                                  owner: owner]);
 }
 
 - (id) initWithPropertyList: (NSDictionary*)propertyList
@@ -312,11 +312,10 @@
                 NSEnumerator *variablesEnum;
                 id fetchSpecName;
 
-                unarchiver = [[[EOKeyValueUnarchiver alloc]
-                               initWithDictionary:
-                                 [NSDictionary dictionaryWithObject: plist
-                                               forKey: @"fspecs"]]
-                              autorelease];
+                unarchiver = AUTORELEASE([[EOKeyValueUnarchiver alloc]
+                              initWithDictionary:
+                              [NSDictionary dictionaryWithObject: plist
+                                            forKey: @"fspecs"]]);
 
                 variables = [unarchiver decodeObjectForKey: @"fspecs"];
                 //NSLog(@"fspecs variables:%@",variables);
@@ -2030,7 +2029,7 @@
   if ([self createsMutableObjects])
     [(GCMutableArray *)_attributes addObject: attribute];
   else
-    _attributes = RETAIN([[_attributes autorelease]
+    _attributes = RETAIN([AUTORELEASE(_attributes)
                     arrayByAddingObject: attribute]);
 
   if (_attributesByName == nil)
@@ -2055,9 +2054,13 @@
        [(GCMutableArray *)_attributes removeObject: attribute];
       else
         {
-          _attributes = [[GCMutableArray alloc] initWithArray:[_attributes 
autorelease] copyItems:NO];
+          _attributes
+           = [[GCMutableArray alloc] initWithArray:AUTORELEASE(_attributes)
+                                     copyItems:NO];
          [(GCMutableArray *)_attributes removeObject: attribute];
-      _attributes = [[GCArray alloc] initWithArray:[_attributes autorelease] 
copyItems:NO];
+         _attributes 
+           = [[GCArray alloc] initWithArray:AUTORELEASE(_attributes)
+                              copyItems:NO];
         }
       [_attributesByName removeObjectForKey: [attribute name]];
       [self _setIsEdited];//To clean caches
@@ -2087,8 +2090,14 @@
   if ([self createsMutableObjects])
     [(GCMutableArray *)_relationships addObject: relationship];
   else
-    _relationships = RETAIN([[_relationships autorelease]
-                       arrayByAddingObject: relationship]);
+    _relationships = RETAIN([AUTORELEASE(_relationships)
+                                       arrayByAddingObject: relationship]);
+    
+  if (_relationshipsByName == nil)
+    {
+      _relationshipsByName = [GCMutableDictionary new];
+    }
+  [_relationshipsByName setObject: relationship forKey: relationshipName];
   
   [relationship setEntity: self];
   [self _setIsEdited];//To clean caches
@@ -2109,9 +2118,13 @@
        [(GCMutableArray *)_relationships removeObject: relationship];
       else
         {
-          _relationships = [[GCMutableArray alloc] 
initWithArray:[_relationships autorelease] copyItems:NO];
+          _relationships
+           = [[GCMutableArray alloc] initWithArray:AUTORELEASE(_relationships)
+                                     copyItems:NO];
          [(GCMutableArray *)_relationships removeObject: relationship];
-         _relationships = [[GCArray alloc] initWithArray:[_relationships 
autorelease] copyItems:NO];
+         _relationships
+           = [[GCArray alloc] initWithArray:AUTORELEASE(_relationships)
+                              copyItems:NO];
         }
       [self _setIsEdited];//To clean caches
     }
@@ -2633,13 +2646,21 @@
 
   if (_flags.createsMutableObjects)
     {
-      _attributes = [[GCMutableArray alloc] initWithArray:[_attributes 
autorelease] copyItems:NO];
-      _relationships = [[GCMutableArray alloc] initWithArray:[_relationships 
autorelease] copyItems:NO];
+      _attributes
+       = [[GCMutableArray alloc] initWithArray:AUTORELEASE(_attributes)
+                                 copyItems:NO];
+      _relationships
+       = [[GCMutableArray alloc] initWithArray:AUTORELEASE(_relationships)
+                                 copyItems:NO];
     }
   else
     {
-      _attributes = [[GCArray alloc] initWithArray:[_attributes autorelease] 
copyItems:NO];
-      _relationships = [[GCArray alloc] initWithArray:[_relationships 
autorelease] copyItems:NO];
+      _attributes
+       = [[GCArray alloc] initWithArray:AUTORELEASE(_attributes)
+                          copyItems:NO];
+      _relationships
+       = [[GCArray alloc] initWithArray:AUTORELEASE(_relationships)
+                          copyItems:NO];
     }
 
   NSAssert4(!_attributesToFetch
@@ -3769,7 +3790,7 @@
 
   EOFLOGObjectLevelArgs(@"EOEntity", @"expression=%@", description);
 
-  expressionArray = [[EOExpressionArray new] autorelease];
+  expressionArray = AUTORELEASE([EOExpressionArray new]);
   s = [description cString];
 
   if (s)
@@ -3855,7 +3876,7 @@
           NSLog(@"exception=%@", localException);
 
           [pool release];//Release the pool !
-          [localException autorelease];
+          AUTORELEASE(localException);
           [localException raise];
         }
       NS_ENDHANDLER;
@@ -4091,7 +4112,7 @@
 
 + (EOEntityClassDescription*)entityClassDescriptionWithEntity: (EOEntity 
*)entity
 {
-  return [[[self alloc] initWithEntity: entity] autorelease];
+  return AUTORELEASE([[self alloc] initWithEntity: entity]);
 }
 
 - (id)initWithEntity: (EOEntity *)entity
@@ -4247,11 +4268,10 @@
                           if (objectTo && [entityTo
                           isPrimaryKeyValidInObject:objectTo] == NO)
                           {
-                          pk = [[[entityTo primaryKeyAttributeNames] 
mutableCopy]
-                          autorelease];
+                          pk = AUTORELEASE([[[entityTo 
primaryKeyAttributeNames] mutableCopy]);
                           [pk removeObjectsInArray:[entityTo 
classPropertyNames]];
                     
-                          pkObj = [[newPK mutableCopy] autorelease];
+                          pkObj = AUTORELEASE([newPK mutableCopy]);
                           [pkObj removeObjectsForKeys:pk];
                     
                           [objectTo takeStoredValuesFromDictionary:pkObj];
@@ -4333,13 +4353,11 @@
     {
       EOFLOGObjectLevelArgs(@"EOEntity", @"objectClass=%@", objectClass);
 
-      obj = [[objectClass allocWithZone:zone]
-             initWithEditingContext: editingContext
-             classDescription: self
-             globalID: globalID];
+      obj = AUTORELEASE([[objectClass allocWithZone:zone]
+                         initWithEditingContext: editingContext
+                         classDescription: self
+                         globalID: globalID]);
     }
-
-  [obj autorelease];
 
   EOFLOGObjectFnStop();
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]