From d17a6b638e529694685a333162bbf6fec6c7fc08 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 20 Aug 2010 10:02:00 +0000 Subject: =?UTF-8?q?=E2=80=A2=20overall=20replacement=20of:=20[aString=20ap?= =?UTF-8?q?pendString:[NSString=20stringWithFormat:]]=20by=20[aString=20ap?= =?UTF-8?q?pendFormat:]=20since=20it's=20much=20more=20faster=20=E2=80=A2?= =?UTF-8?q?=20first=20look=20at=20loop=20where=20several=20[aStr=20appendS?= =?UTF-8?q?tring:]=20occur=20to=20try=20to=20combine=20them=20into=20one?= =?UTF-8?q?=20appendString=20or=20appendFormat=20since=20the=20allocation?= =?UTF-8?q?=20of=20memory=20takes=20really=20time?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note: I tested all my changes but we should test it further to be sure that I didn't a mistake! --- Source/SPCustomQuery.m | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'Source/SPCustomQuery.m') diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 31aaea54..80ec1c33 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -652,9 +652,9 @@ if(!suppressErrorSheet) { // Update error text for the user - [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in query %ld] %@\n", @"error text when multiple custom query failed"), + [errors appendFormat:NSLocalizedString(@"[ERROR in query %ld] %@\n", @"error text when multiple custom query failed"), (long)(i+1), - errorString]]; + errorString]; [[errorText onMainThread] setStringValue:errors]; // ask the user to continue after detecting an error @@ -682,9 +682,9 @@ } } } else { - [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in query %ld] %@\n", @"error text when multiple custom query failed"), + [errors appendFormat:NSLocalizedString(@"[ERROR in query %ld] %@\n", @"error text when multiple custom query failed"), (long)(i+1), - errorString]]; + errorString]; } } else { [errors setString:errorString]; @@ -2818,18 +2818,14 @@ // break; // } - [theHelp appendString:@"
"];
-			[theHelp appendString:desc];
-			[theHelp appendString:@"
"]; + [theHelp appendFormat:@"
%@
", desc]; } // are examples available? if([tableDetails objectForKey:@"example"]){ NSString *examples = [[[tableDetails objectForKey:@"example"] copy] autorelease]; - if([examples length]){ - [theHelp appendString:@"
Example:
"];
-				[theHelp appendString:examples];
-				[theHelp appendString:@"
"]; - } + if([examples length]) + [theHelp appendFormat:@"
Example:
%@
", examples]; + } } else { // list all found topics NSInteger i; @@ -2837,17 +2833,17 @@ if (r) [theResult dataSeek:0]; // check if HELP 'contents' is called if(![searchString isEqualToString:SP_HELP_TOC_SEARCH_STRING]) - [theHelp appendString:[NSString stringWithFormat:@"
%@ “%@”
", NSLocalizedString(@"Help topics for", @"help topics for"), searchString]]; + [theHelp appendFormat:@"
%@ “%@”
", NSLocalizedString(@"Help topics for", @"help topics for"), searchString]; else - [theHelp appendString:[NSString stringWithFormat:@"
%@:
", NSLocalizedString(@"MySQL Help – Categories", @"mysql help categories"), searchString]]; + [theHelp appendFormat:@"
%@:
", NSLocalizedString(@"MySQL Help – Categories", @"mysql help categories"), searchString]; // iterate through all found rows and print them as HTML ul/li list [theHelp appendString:@""]; } -- cgit v1.2.3