Revision: 14169
          http://sourceforge.net/p/skim-app/code/14169
Author:   hofman
Date:     2024-04-03 14:31:08 +0000 (Wed, 03 Apr 2024)
Log Message:
-----------
avoid some variables

Modified Paths:
--------------
    trunk/SKPDFSynchronizer.m

Modified: trunk/SKPDFSynchronizer.m
===================================================================
--- trunk/SKPDFSynchronizer.m   2024-04-03 09:34:45 UTC (rev 14168)
+++ trunk/SKPDFSynchronizer.m   2024-04-03 14:31:08 UTC (rev 14169)
@@ -228,7 +228,6 @@
         NSInteger recordIndex, line, pageIndex;
         double x, y;
         SKPDFSyncRecord *record;
-        NSMutableArray *array;
         unichar ch;
         NSScanner *sc = [[NSScanner alloc] initWithString:pdfsyncString];
         NSCharacterSet *newlines = [NSCharacterSet newlineCharacterSet];
@@ -241,8 +240,7 @@
             file = [self sourceFileForFileName:file isTeX:YES 
removeQuotes:YES];
             [files addObject:file];
             
-            array = [[NSMutableArray alloc] init];
-            [[pdfsync lines] setObject:array forKey:file];
+            [[pdfsync lines] setObject:[NSMutableArray array] forKey:file];
             
             // we ignore the version
             if ([sc scanString:@"version" intoString:NULL] && [sc 
scanInteger:NULL]) {
@@ -276,10 +274,8 @@
                         case 's':
                             // start of a new page, the scanned integer should 
always equal [[pdfsync pages] count]+1
                             if ([sc scanInteger:&pageIndex] == NO) pageIndex = 
[[pdfsync pages] count] + 1;
-                            while (pageIndex > (NSInteger)[[pdfsync pages] 
count]) {
-                                array = [[NSMutableArray alloc] init];
-                                [[pdfsync pages] addObject:array];
-                            }
+                            while (pageIndex > (NSInteger)[[pdfsync pages] 
count])
+                                [[pdfsync pages] addObject:[NSMutableArray 
array]];
                             break;
                         case '(':
                             // start of a new source file
@@ -286,10 +282,8 @@
                             if ([sc scanUpToCharactersFromSet:newlines 
intoString:&file]) {
                                 file = [self sourceFileForFileName:file 
isTeX:YES removeQuotes:YES];
                                 [files addObject:file];
-                                if ([[pdfsync lines] objectForKey:file] == 
nil) {
-                                    array = [[NSMutableArray alloc] init];
-                                    [[pdfsync lines] setObject:array 
forKey:file];
-                                }
+                                if ([[pdfsync lines] objectForKey:file] == nil)
+                                    [[pdfsync lines] setObject:[NSMutableArray 
array] forKey:file];
                             }
                             break;
                         case ')':
@@ -308,14 +302,13 @@
                     [sc scanCharactersFromSet:newlines intoString:NULL];
                 }
                 
-                NSSortDescriptor *lineSortDescriptor = [[NSSortDescriptor 
alloc] initWithKey:@"line" ascending:YES];
-                NSSortDescriptor *xSortDescriptor = [[NSSortDescriptor alloc] 
initWithKey:@"x" ascending:YES];
-                NSSortDescriptor *ySortDescriptor = [[NSSortDescriptor alloc] 
initWithKey:@"y" ascending:NO];
+                NSArray *lineSortDescriptors = @[[[NSSortDescriptor alloc] 
initWithKey:@"line" ascending:YES]];
+                NSArray *recordSortDescriptors = @[[[NSSortDescriptor alloc] 
initWithKey:@"x" ascending:YES], [[NSSortDescriptor alloc] initWithKey:@"y" 
ascending:NO]];
                 
-                for (array in [[pdfsync lines] objectEnumerator])
-                    [array sortUsingDescriptors:@[lineSortDescriptor]];
+                for (NSMutableArray *array in [[pdfsync lines] 
objectEnumerator])
+                    [array sortUsingDescriptors:lineSortDescriptors];
                 [[pdfsync pages] 
makeObjectsPerformSelector:@selector(sortUsingDescriptors:)
-                                       withObject:@[ySortDescriptor, 
xSortDescriptor]];
+                                       withObject:recordSortDescriptors];
                 
                 rv = [self shouldKeepRunning];
             }

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to