bug-gnustep
[Top][All Lists]
Advanced

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

[GDL2][COMMIT] EODatabaseContext: Use AUTORELEASE macro


From: David Ayers
Subject: [GDL2][COMMIT] EODatabaseContext: Use AUTORELEASE macro
Date: Thu, 08 May 2003 13:43:00 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4a) Gecko/20030401

Hi,

some minor cleanups to EODatabasContext:

       * EOAccess/EODatabaseContext.m
       ([EODatabaseContext -dealloc]): Corrected debug logs.
       ([EODatabaseContext +databaseContextWithDatabase:]): Use
       AUTORELEASE instead of autorelease.
       ([EODatabaseContext -initWithDatabase:]): Ditto.
       ([EODatabaseContext
       -objectsWithFetchSpecification:editingContext:]): Ditto.
       ([EODatabaseContext
       -_dbOperationWithGlobalID:object:entity:operator:]): Ditto.
       ([EODatabaseContext -recordChangesInEditingContext]): Ditto.
       ([EODatabaseContext
       -relayAttributesInRelationship:sourceObject:destinationObject:]):
       Ditto.
       ([EODatabaseContext
       -createAdaptorOperationsForDatabaseOperation:attributes:]):
       Ditto.
       ([EODatabaseContext -_fireFault:]): Ditto.
       ([EODatabaseContext -_batchToOne:withHandler:]): Ditto.
       ([EODatabaseContext -_commitTransaction]): Ditto.
       ([EODatabaseContext -handleDroppedConnection]): Use
       RELEASE instead of release.
       ([EODatabaseContext -databaseOperationForObject:]): Ditto.
       ([EODatabaseContext -_fireArrayFault:]): Ditto.


Commited,

Cheers,
Dave

Index: EOAccess/EODatabaseContext.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/dev-libs/gdl2/EOAccess/EODatabaseContext.m,v
retrieving revision 1.18
diff -u -r1.18 EODatabaseContext.m
--- EOAccess/EODatabaseContext.m        2 May 2003 17:00:23 -0000       1.18
+++ EOAccess/EODatabaseContext.m        8 May 2003 11:39:23 -0000
@@ -130,7 +130,7 @@
 
 + (EODatabaseContext*)databaseContextWithDatabase: (EODatabase *)database
 {
-  return [[[self alloc] initWithDatabase: database] autorelease];
+  return AUTORELEASE([[self alloc] initWithDatabase: database]);
 }
 
 + (void)_registerDatabaseContext:(NSNotification *)notification
@@ -202,7 +202,7 @@
       if (_adaptorContext == nil)
         {
           NSLog(@"EODatabaseContext could not create adaptor context");
-          [self autorelease];
+          AUTORELEASE(self);
 
           return nil;
         }
@@ -241,16 +241,12 @@
       _toManySnapshots = [NSMutableDictionary new];
 */
       
-      
-      
-      
 //NO      _lock = [NSRecursiveLock new];
       
 //NO      _numLocked = 0;
 //After      _lockedObjects = NSZoneMalloc(NULL, _LOCK_BUFFER*sizeof(id));
       
       
-      
       /* //TODO ?
          transactionStackTop = NULL;
          transactionNestingLevel = 0;
@@ -289,7 +285,8 @@
 
   if (_dbOperationsByGlobalID)
     {
-      NSDebugMLog(@"MEMORY: dbOperationsByGlobalID 
count=%u",NSCountMapTable(_dbOperationsByGlobalID));
+      NSDebugMLog(@"MEMORY: dbOperationsByGlobalID count=%u",
+                 NSCountMapTable(_dbOperationsByGlobalID));
       NSFreeMapTable(_dbOperationsByGlobalID);
       _dbOperationsByGlobalID = NULL;
     }
@@ -310,8 +307,8 @@
 
   if (_nonPrimaryKeyGenerators)
     {
-      NSDebugMLog(@"MEMORY: dbOperationsByGlobalID count=%u",
-                 NSCountMapTable(_dbOperationsByGlobalID));
+      NSDebugMLog(@"MEMORY: nonPrimaryKeyGnerators count=%u",
+                 NSCountMapTable(_nonPrimaryKeyGenerators));
 
       NSFreeHashTable(_nonPrimaryKeyGenerators);
       _nonPrimaryKeyGenerators = NULL;
@@ -613,8 +610,8 @@
   
   for (i = [_registeredChannels count] - 1; i >= 0; i--)
     {
-      [(EODatabaseChannel *)[[_registeredChannels objectAtIndex: i]
-                             nonretainedObjectValue] release];
+      RELEASE((EODatabaseChannel *)[[_registeredChannels objectAtIndex: i]
+                             nonretainedObjectValue]);
     }
 
   DESTROY(_registeredChannels);
@@ -1342,7 +1339,7 @@
          {
          EOFetchSpecification *fetchSubEntity;
 
-         fetchSubEntity = [[fetch copy] autorelease];
+         fetchSubEntity = AUTORELEASE([fetch copy]);
          [fetchSubEntity setEntityName:[entity name]];
 
          [array addObjectsFromArray:[context objectsWithFetchSpecification:
@@ -1529,7 +1526,7 @@
 
                    RETAIN(localException);
                    DESTROY(arp);
-                   [localException autorelease];
+                   AUTORELEASE(localException);
                    [localException raise];
                  }
                NS_ENDHANDLER;
@@ -1855,7 +1852,7 @@
 
                       RETAIN(localException);
                       DESTROY(arp);
-                      [localException autorelease];
+                      AUTORELEASE(localException);
                       [localException raise];
                     }
                   NS_ENDHANDLER;
@@ -2105,7 +2102,7 @@
   else
     return NO;
 }
-/*//Mirko:
+/* //Mirko:
 - (EODatabaseOperation *)_dbOperationWithObject:object
                                       operator:(EODatabaseOperator)operator
 {
@@ -2170,11 +2167,11 @@
     return op;
 
   if (globalID == nil)
-    globalID = [[[EOTemporaryGlobalID alloc] init] autorelease];
+    globalID = AUTORELEASE([[EOTemporaryGlobalID alloc] init]);
 
-  op = [[[EODatabaseOperation alloc] initWithGlobalID:globalID
-                                    object:object
-                                    entity:entity] autorelease];
+  op = AUTORELEASE([[EODatabaseOperation alloc] initWithGlobalID:globalID
+                                               object:object
+                                               entity:entity]);
 
   [op setDatabaseOperator:operator];
   [op setDBSnapshot:[self snapshotForGlobalID:globalID]];
@@ -2768,9 +2765,9 @@
                      id toManyObj;
 
                      EOFLOGObjectLevelArgs(@"EODatabaseContext",@"rel 1 
sourceGID=%@", gid);
-                     toManySnapshot = [[[self snapshotForSourceGlobalID:gid
-                                              relationshipName:name]
-                                         mutableCopy] autorelease];
+                     toManySnapshot = AUTORRELEASE([[self 
snapshotForSourceGlobalID:gid
+                                                          
relationshipName:name]
+                                                     mutableCopy]);
                      if (toManySnapshot == nil)
                        toManySnapshot = [NSMutableArray array];
                      EOFLOGObjectLevelArgs(@"EODatabaseContext",@"rel 1", 
name);
@@ -3495,7 +3492,7 @@
                                     _LOCK_BUFFER*sizeof(id));
 
       NSResetMapTable(_dbOperationsByGlobalID);
-/*//TODO
+/* //TODO
       [_snapshots removeAllObjects];
       [_toManySnapshots removeAllObjects];
 */
@@ -3760,8 +3757,8 @@
 
       if (foreignKeyInDestination || [relationship propagatesPrimaryKey])
         {
-          relayedValues = [[[sourceNewRow valuesForKeys: sourceKeys]
-                            mutableCopy] autorelease];// {code = 0; }
+          relayedValues = AUTORELEASE([[sourceNewRow valuesForKeys: sourceKeys]
+                            mutableCopy]);// {code = 0; }
           EOFLOGObjectLevelArgs(@"EODatabaseContext", @"relayedValues=%@",
                                relayedValues);
 
@@ -3885,9 +3882,9 @@
                          inverse = [property inverseRelationship];
                          if (inverse)
                            {
-                             toManySnapshot = [[[self 
snapshotForSourceGlobalID:gid
+                             toManySnapshot = AUTORELEASE([[self 
snapshotForSourceGlobalID:gid
                                                       
relationshipName:[inverse name]]
-                                                 mutableCopy] autorelease];
+                                                 mutableCopy]);
                              if (toManySnapshot == nil)
                                toManySnapshot = [NSMutableArray array];
 
@@ -4159,7 +4156,7 @@
 
            [databaseOpe setNewRow: newRow];
            [self recordDatabaseOperation: databaseOpe];
-           [newRow release];
+           RELEASE(newRow);
          }
     }
   NS_HANDLER
@@ -4513,15 +4510,14 @@
               }
             EOFLOGObjectLevelArgs(@"EODatabaseContext",@"lock stop2");
             
-            qualifier = [[[EOAndQualifier alloc]
+            qualifier = AUTORELEASE([[EOAndQualifier alloc]
                            initWithQualifiers:
                              [entity qualifierForPrimaryKey:
                                        [entity primaryKeyForGlobalID:
                                                  (EOKeyGlobalID *)gid]],
                            [EOQualifier qualifierToMatchAllValues:
                                           qualifierSnapshot],
-                           nil]
-                          autorelease];
+                           nil]);
 
                           if ([lockAttributes count] == 0)
                           lockAttributes = nil;
@@ -4579,12 +4575,10 @@
           adaptorOperator = EOAdaptorDeleteOperator;
           /*
             MIRKO
-            NSMutableArray *newKeys = [[[NSMutableArray alloc]
-            initWithCapacity:count]
-            autorelease];
-            NSMutableArray *newVals = [[[NSMutableArray alloc]
-            initWithCapacity:count]
-            autorelease];
+            NSMutableArray *newKeys = AUTORELEASE([[NSMutableArray alloc]
+            initWithCapacity:count]);
+            NSMutableArray *newVals = AUTORELEASE([[NSMutableArray alloc]
+            initWithCapacity:count]);
             
             if ([entity isReadOnly] == YES)
             {
@@ -5475,7 +5469,7 @@
          [handler faultWillFire:object];
          targetClass=[handler targetClass];
          extraData=[handler extraData];
-         [handler release];
+         RELEASE(handler);
       */
       EOFLOGObjectLevelArgs(@"EODatabaseContext",
                            @"NEAR FINISHED 1 object count=%d %p %@",
@@ -5683,7 +5677,7 @@
         previousHandler = (EOAccessFaultHandler *)[handler previous];
         nextHandler = (EOAccessFaultHandler *)[handler next]; //nil
 
-        fetchSpecif = [[EOFetchSpecification new] autorelease];
+        fetchSpecif = AUTORELEASE([EOFetchSpecification new]);
         [fetchSpecif setEntityName: entityName];
 
         qualifier = [EOOrQualifier qualifierWithQualifierArray: qualifiers];
@@ -5785,8 +5779,8 @@
                                                [usedHandler globalID]]]];
        }
 
-      qualifier = [[[EOOrQualifier alloc]
-                    initWithQualifierArray:qualifierArray] autorelease];
+      qualifier = AUTORELEASE([[EOOrQualifier alloc]
+                    initWithQualifierArray:qualifierArray]);
     }
 
   if (firstHandler == nil)
@@ -6403,12 +6397,11 @@
 
   if ([_uniqueStack count] > 0)
     {
-      NSMutableDictionary *snapshotsDict = [RETAIN([_uniqueStack lastObject]) 
autorelease];
-      NSMutableDictionary *toManySnapshotsDict = [RETAIN([_uniqueArrayStack
-                                                          lastObject])
-                                                       autorelease];
-      /*NSMutableDictionary *deleteSnapshotsDict = [[[_deleteStack lastObject]
-       retain] autorelease];*/ //??
+      NSMutableDictionary *snapshotsDict = AUTORELEASE(RETAIN([_uniqueStack 
lastObject]));
+      NSMutableDictionary *toManySnapshotsDict = 
AUTORELEASE(RETAIN([_uniqueArrayStack
+                                                                     
lastObject]));
+      /*NSMutableDictionary *deleteSnapshotsDict 
+       = AUTORELEASE(RETAIN([_deleteStack lastObject]));*/ //??
 
       [_uniqueStack removeLastObject];
       [_uniqueArrayStack removeLastObject];


reply via email to

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