aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPServerVariablesController.m
diff options
context:
space:
mode:
authorMax Lohrmann <dmoagx@users.noreply.github.com>2017-03-12 09:46:59 +0100
committerMax Lohrmann <dmoagx@users.noreply.github.com>2017-03-12 09:46:59 +0100
commit95250e0f0c5780ac113a9a4c948c452038b4c02a (patch)
tree18d41b1a2bae49b38e58d986e5d3934aac8b3227 /Source/SPServerVariablesController.m
parentf5e022b6667815a05c0b2478db07f50af2e52d0b (diff)
downloadsequelpro-95250e0f0c5780ac113a9a4c948c452038b4c02a.tar.gz
sequelpro-95250e0f0c5780ac113a9a4c948c452038b4c02a.tar.bz2
sequelpro-95250e0f0c5780ac113a9a4c948c452038b4c02a.zip
Replace some legacy NSIndexSet enumeration with 10.6+ style -enumerateIndexesUsingBlock:
Diffstat (limited to 'Source/SPServerVariablesController.m')
-rw-r--r--Source/SPServerVariablesController.m16
1 files changed, 6 insertions, 10 deletions
diff --git a/Source/SPServerVariablesController.m b/Source/SPServerVariablesController.m
index dade0687..d99f8671 100644
--- a/Source/SPServerVariablesController.m
+++ b/Source/SPServerVariablesController.m
@@ -342,13 +342,10 @@
if ((firstResponder == variablesTableView) && ([variablesTableView numberOfSelectedRows] > 0)) {
- NSString *string = @"";
+ NSMutableString *string = [[NSMutableString alloc] init];
NSIndexSet *rows = [variablesTableView selectedRowIndexes];
- NSUInteger i = [rows firstIndex];
-
- while (i != NSNotFound)
- {
+ [rows enumerateIndexesUsingBlock:^(NSUInteger i, BOOL * _Nonnull stop) {
if (i < [variablesFiltered count]) {
NSDictionary *variable = NSArrayObjectAtIndex(variablesFiltered, i);
@@ -357,21 +354,20 @@
// Decide what to include in the string
if (name && value) {
- string = [string stringByAppendingFormat:@"%@ = %@\n", variableName, variableValue];
+ [string appendFormat:@"%@ = %@\n", variableName, variableValue];
}
else {
- string = [string stringByAppendingFormat:@"%@\n", (name) ? variableName : variableValue];
+ [string appendFormat:@"%@\n", (name) ? variableName : variableValue];
}
}
-
- i = [rows indexGreaterThanIndex:i];
- }
+ }];
NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard];
// Copy the string to the pasteboard
[pasteBoard declareTypes:@[NSStringPboardType] owner:nil];
[pasteBoard setString:string forType:NSStringPboardType];
+ [string release];
}
}