Revision: 28535
          http://sourceforge.net/p/bibdesk/svn/28535
Author:   hofman
Date:     2024-01-04 16:32:12 +0000 (Thu, 04 Jan 2024)
Log Message:
-----------
avoid some autorelease

Modified Paths:
--------------
    trunk/bibdesk/BDSKBookmarkController.m
    trunk/bibdesk/BDSKCharacterConversion.m
    trunk/bibdesk/BDSKDocumentSearch.m
    trunk/bibdesk/BDSKMacroResolver.m
    trunk/bibdesk/BDSKPreferenceController.m
    trunk/bibdesk/BDSKSearchBookmarkController.m
    trunk/bibdesk/BDSKStringEncodingManager.m
    trunk/bibdesk/BDSKURLGroup.m

Modified: trunk/bibdesk/BDSKBookmarkController.m
===================================================================
--- trunk/bibdesk/BDSKBookmarkController.m      2024-01-04 10:30:32 UTC (rev 
28534)
+++ trunk/bibdesk/BDSKBookmarkController.m      2024-01-04 16:32:12 UTC (rev 
28535)
@@ -94,7 +94,7 @@
 
 + (id)sharedBookmarkController {
     if (sharedBookmarkController == nil)
-        [[[self alloc] init] autorelease];
+        (void)[[[self alloc] init] autorelease];
     return sharedBookmarkController;
 }
 

Modified: trunk/bibdesk/BDSKCharacterConversion.m
===================================================================
--- trunk/bibdesk/BDSKCharacterConversion.m     2024-01-04 10:30:32 UTC (rev 
28534)
+++ trunk/bibdesk/BDSKCharacterConversion.m     2024-01-04 16:32:12 UTC (rev 
28535)
@@ -109,7 +109,7 @@
                [texSet addObjectsFromArray:[twoWayDict allValues]];
        }
        
-       [currentArray autorelease];
+       [currentArray release];
        currentArray = [[currentDict allKeys] mutableCopy];
        
        validRoman = YES;
@@ -138,7 +138,7 @@
        }
        
        currentDict = (listType == BDSKListTypeOneWay)? oneWayDict : twoWayDict;
-       [currentArray autorelease];
+       [currentArray release];
        currentArray = [[currentDict allKeys] mutableCopy];
        
        validRoman = YES;

Modified: trunk/bibdesk/BDSKDocumentSearch.m
===================================================================
--- trunk/bibdesk/BDSKDocumentSearch.m  2024-01-04 10:30:32 UTC (rev 28534)
+++ trunk/bibdesk/BDSKDocumentSearch.m  2024-01-04 16:32:12 UTC (rev 28535)
@@ -194,14 +194,16 @@
 - (void)searchForString:(NSString *)searchString index:(SKIndexRef)skIndex 
selectedPublications:(NSArray *)selPubs 
scrollPositionAsPercentage:(NSPoint)scrollPoint;
 {
     if ([self isSearching] == NO) {
-        [previouslySelectedPublications autorelease];
+        [previouslySelectedPublications release];
         previouslySelectedPublications = [[NSArray alloc] 
initWithArray:selPubs copyItems:NO];
         previousScrollPositionAsPercentage = scrollPoint;
     }
     
     @synchronized(self) {
-        [currentSearchString autorelease];
-        currentSearchString = [searchString copy];
+        if (searchString != currentSearchString) {
+            [currentSearchString release];
+            currentSearchString = [searchString copy];
+        }
     }
 
     if ([self isSearching])

Modified: trunk/bibdesk/BDSKMacroResolver.m
===================================================================
--- trunk/bibdesk/BDSKMacroResolver.m   2024-01-04 10:30:32 UTC (rev 28534)
+++ trunk/bibdesk/BDSKMacroResolver.m   2024-01-04 16:32:12 UTC (rev 28535)
@@ -215,19 +215,19 @@
                     format:@"tried to change the value of a macro key that 
doesn't exist"];
     [[[self undoManager] prepareWithInvocationTarget:self]
         changeMacro:newMacro to:oldMacro];
-    NSString *val = [macroDefinitions valueForKey:oldMacro];
     
     // retain in case these go away with removeObjectForKey:
-    [[val retain] autorelease]; 
-    [[oldMacro retain] autorelease];
+    NSString *val = [[macroDefinitions valueForKey:oldMacro] retain];
+    NSDictionary *userInfo = [NSDictionary 
dictionaryWithObjectsAndKeys:BDSKMacroResolverRenameType, 
BDSKMacroResolverTypeKey, oldMacro, BDSKMacroResolverOldMacroKey, 
newMacro,BDSKMacroResolverNewMacroKey, nil];
+    
     [macroDefinitions removeObjectForKey:oldMacro];
     [macroDefinitions setObject:val forKey:newMacro];
-       
+    [val release];
+    
     modification++;
     [self synchronize];
     
-    NSDictionary *userInfo = [NSDictionary 
dictionaryWithObjectsAndKeys:BDSKMacroResolverRenameType, 
BDSKMacroResolverTypeKey, oldMacro, BDSKMacroResolverOldMacroKey, 
newMacro,BDSKMacroResolverNewMacroKey, nil];
-    [[NSNotificationCenter defaultCenter] 
postNotificationName:BDSKMacroDefinitionChangedNotification 
+    [[NSNotificationCenter defaultCenter] 
postNotificationName:BDSKMacroDefinitionChangedNotification
                                                         object:self
                                                       userInfo:userInfo];    
 }

Modified: trunk/bibdesk/BDSKPreferenceController.m
===================================================================
--- trunk/bibdesk/BDSKPreferenceController.m    2024-01-04 10:30:32 UTC (rev 
28534)
+++ trunk/bibdesk/BDSKPreferenceController.m    2024-01-04 16:32:12 UTC (rev 
28535)
@@ -127,7 +127,7 @@
 
 + (id)sharedPreferenceController {
     if (nil == sharedController)
-        [[[self alloc] init] release];
+        (void)[[[self alloc] init] release];
     return sharedController;
 }
 

Modified: trunk/bibdesk/BDSKSearchBookmarkController.m
===================================================================
--- trunk/bibdesk/BDSKSearchBookmarkController.m        2024-01-04 10:30:32 UTC 
(rev 28534)
+++ trunk/bibdesk/BDSKSearchBookmarkController.m        2024-01-04 16:32:12 UTC 
(rev 28535)
@@ -91,7 +91,7 @@
 
 + (id)sharedBookmarkController {
     if (sharedBookmarkController == nil)
-        [[[self alloc] init] autorelease];
+        (void)[[[self alloc] init] autorelease];
     return sharedBookmarkController;
 }
 

Modified: trunk/bibdesk/BDSKStringEncodingManager.m
===================================================================
--- trunk/bibdesk/BDSKStringEncodingManager.m   2024-01-04 10:30:32 UTC (rev 
28534)
+++ trunk/bibdesk/BDSKStringEncodingManager.m   2024-01-04 16:32:12 UTC (rev 
28535)
@@ -363,7 +363,7 @@
         }
     }
     
-    [encodings autorelease];
+    [encodings release];
     encodings = encs;
 
     [self noteEncodingListChange:YES updateList:NO postNotification:YES];
@@ -370,19 +370,19 @@
 }
 
 - (IBAction)clearAll:(id)sender {
-    [encodings autorelease];
+    [encodings release];
     encodings = [@[] retain];                          // Empty encodings list
     [self noteEncodingListChange:YES updateList:YES postNotification:YES];
 }
 
 - (IBAction)selectAll:(id)sender {
-    [encodings autorelease];
+    [encodings release];
     encodings = [[[self class] allAvailableStringEncodings] retain];   // All 
encodings
     [self noteEncodingListChange:YES updateList:YES postNotification:YES];
 }
 
 - (IBAction)revertToDefault:(id)sender {
-    [encodings autorelease];
+    [encodings release];
     encodings = nil;
     [[NSUserDefaults standardUserDefaults] 
setObject:[[[NSUserDefaultsController sharedUserDefaultsController] 
initialValues] objectForKey:BDSKStringEncodingsKey] 
forKey:BDSKStringEncodingsKey];
     (void)[self enabledEncodings];                                     // 
Regenerate default list

Modified: trunk/bibdesk/BDSKURLGroup.m
===================================================================
--- trunk/bibdesk/BDSKURLGroup.m        2024-01-04 10:30:32 UTC (rev 28534)
+++ trunk/bibdesk/BDSKURLGroup.m        2024-01-04 16:32:12 UTC (rev 28535)
@@ -194,8 +194,10 @@
         theURL = [theURL fileURLByStrictlyResolvingAliases];
         BOOL isDir = NO;
         if([[NSFileManager defaultManager] fileExistsAtPath:[theURL path] 
isDirectory:&isDir] && NO == isDir){
-            [fileURL autorelease];
-            fileURL = [theURL copy];
+            if (theURL != fileURL) {
+                [fileURL release];
+                fileURL = [theURL copy];
+            }
             [self getPublications];
         } else {
             NSError *error = [NSError 
mutableLocalErrorWithCode:kBDSKFileNotFound localizedDescription:nil];
@@ -237,8 +239,10 @@
 }
 
 - (void)download:(BDSKDownload *)aDownload didCreateDestination:(NSURL 
*)destinationURL {
-    [fileURL autorelease];
-    fileURL = [destinationURL copy];
+    if (destinationURL != fileURL) {
+        [fileURL release];
+        fileURL = [destinationURL copy];
+    }
 }
 
 - (void)download:(BDSKDownload *)aDownload didCompleteWithError:(NSError 
*)error

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to