diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-08-20 10:02:00 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-08-20 10:02:00 +0000 |
commit | d17a6b638e529694685a333162bbf6fec6c7fc08 (patch) | |
tree | 5c72506af7bf75299c093ce6a47b7cc4a956e0ff /Source/SPCustomQuery.m | |
parent | dabf6466f11e5936ee871b8b3dd573020a142586 (diff) | |
download | sequelpro-d17a6b638e529694685a333162bbf6fec6c7fc08.tar.gz sequelpro-d17a6b638e529694685a333162bbf6fec6c7fc08.tar.bz2 sequelpro-d17a6b638e529694685a333162bbf6fec6c7fc08.zip |
• overall replacement of:
[aString appendString:[NSString stringWithFormat:]] by
[aString appendFormat:]
since it's much more faster
• first look at loop where several [aStr appendString:] occur to try to combine them into one appendString or appendFormat since the allocation of memory takes really time
Note: I tested all my changes but we should test it further to be sure that I didn't a mistake!
Diffstat (limited to 'Source/SPCustomQuery.m')
-rw-r--r-- | Source/SPCustomQuery.m | 28 |
1 files changed, 12 insertions, 16 deletions
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:@"<pre class='description'>"]; - [theHelp appendString:desc]; - [theHelp appendString:@"</pre>"]; + [theHelp appendFormat:@"<pre class='description'>%@</pre>", desc]; } // are examples available? if([tableDetails objectForKey:@"example"]){ NSString *examples = [[[tableDetails objectForKey:@"example"] copy] autorelease]; - if([examples length]){ - [theHelp appendString:@"<br><i><b>Example:</b></i><br><pre class='example'>"]; - [theHelp appendString:examples]; - [theHelp appendString:@"</pre>"]; - } + if([examples length]) + [theHelp appendFormat:@"<br><i><b>Example:</b></i><br><pre class='example'>%@</pre>", 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:@"<br><i>%@ “%@”</i><br>", NSLocalizedString(@"Help topics for", @"help topics for"), searchString]]; + [theHelp appendFormat:@"<br><i>%@ “%@”</i><br>", NSLocalizedString(@"Help topics for", @"help topics for"), searchString]; else - [theHelp appendString:[NSString stringWithFormat:@"<br><b>%@:</b><br>", NSLocalizedString(@"MySQL Help – Categories", @"mysql help categories"), searchString]]; + [theHelp appendFormat:@"<br><b>%@:</b><br>", NSLocalizedString(@"MySQL Help – Categories", @"mysql help categories"), searchString]; // iterate through all found rows and print them as HTML ul/li list [theHelp appendString:@"<ul>"]; for ( i = 0 ; i < r ; i++ ) { NSArray *anArray = [theResult fetchRowAsArray]; NSString *topic = [anArray objectAtIndex:[anArray count]-2]; - [theHelp appendString: - [NSString stringWithFormat:@"<li><a title='%@ “%@”' href='%@' class='internallink'>%@</a></li>", NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), topic, topic, topic]]; + [theHelp appendFormat:@"<li><a title='%@ “%@”' href='%@' class='internallink'>%@</a></li>", + NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), topic, topic, topic]; } [theHelp appendString:@"</ul>"]; } |