]> granicus.if.org Git - transmission/commitdiff
store the list of newly-adding transfers in a set rather than an array
authorMitchell Livingston <livings124@transmissionbt.com>
Sun, 8 Jan 2012 04:11:07 +0000 (04:11 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Sun, 8 Jan 2012 04:11:07 +0000 (04:11 +0000)
macosx/Controller.h
macosx/Controller.m

index 61359311308c72900f495d48c413cba3f23f91df..99c3cf5712fa41d0ca11efa61b671d6557e21906 100644 (file)
@@ -103,7 +103,7 @@ typedef enum
     
     NSMutableDictionary             * fPendingTorrentDownloads;
     
-    NSMutableArray                  * fAddingTransfers;
+    NSMutableSet                    * fAddingTransfers;
     
     BOOL                            fGlobalPopoverShown;
     BOOL                            fSoundPlaying;
index 01b8df6df9e79cd1feda6912a811d17862272bef..3280730b0a45801b24e17219356978032db4aea5 100644 (file)
@@ -887,7 +887,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
             [torrent release];
             
             if (!fAddingTransfers)
-                fAddingTransfers = [[NSMutableArray alloc] init];
+                fAddingTransfers = [[NSMutableSet alloc] init];
             [fAddingTransfers addObject: torrent];
         }
     }
@@ -909,7 +909,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
         [torrent release];
         
         if (!fAddingTransfers)
-            fAddingTransfers = [[NSMutableArray alloc] init];
+            fAddingTransfers = [[NSMutableSet alloc] init];
         [fAddingTransfers addObject: torrent];
         
         [self fullUpdateUI];
@@ -967,7 +967,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
         [torrent release];
         
         if (!fAddingTransfers)
-            fAddingTransfers = [[NSMutableArray alloc] init];
+            fAddingTransfers = [[NSMutableSet alloc] init];
         [fAddingTransfers addObject: torrent];
     }
 
@@ -988,7 +988,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
         [torrent release];
         
         if (!fAddingTransfers)
-            fAddingTransfers = [[NSMutableArray alloc] init];
+            fAddingTransfers = [[NSMutableSet alloc] init];
         [fAddingTransfers addObject: torrent];
         
         [self fullUpdateUI];
@@ -1686,7 +1686,6 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
 {
     CGFloat dlRate = 0.0, ulRate = 0.0;
     BOOL completed = NO;
-    #warning use a block to do in parallel?
     for (Torrent * torrent in fTorrents)
     {
         [torrent update];
@@ -2177,8 +2176,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
                 return objDisplay == objAll;
             }];
             
-            if (index == NSNotFound){
-                [(Torrent *)objDisplay setPreviousFinishedPieces: nil];}
+            if (index == NSNotFound)
+                [(Torrent *)objDisplay setPreviousFinishedPieces: nil];
             else
                 [unusedIndexesInAll removeIndex: index];
         };
@@ -4561,7 +4560,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
     [torrent release];
     
     if (!fAddingTransfers)
-        fAddingTransfers = [[NSMutableArray alloc] init];
+        fAddingTransfers = [[NSMutableSet alloc] init];
     [fAddingTransfers addObject: torrent];
     
     [self fullUpdateUI];