Make repetitive array creation only happen once on OS X.

git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@78288 e17a0e51-4ae3-4d35-97c3-1a29b211df97
This commit is contained in:
SND\MaddTheSane_cp 2012-05-23 23:20:57 +00:00
parent 3e2fd08a49
commit 659ecb8f16
5 changed files with 24 additions and 5 deletions

View File

@ -511,7 +511,10 @@ static NSString *HandleBinCue(NSString *toHandle)
NSRunAlertPanel(NSLocalizedString(@"Error opening file",nil), [NSString stringWithFormat:NSLocalizedString(@"Unable to open %@: %@", nil), [filename lastPathComponent], [err localizedFailureReason]], nil, nil, nil);
return NO;
}
NSArray *handlers = [NSArray arrayWithObjects:[PcsxrPluginHandler class], [PcsxrMemCardHandler class], [PcsxrFreezeStateHandler class], [PcsxrDiscHandler class], nil];
static NSArray *handlers = nil;
if (handlers == nil) {
handlers = [[NSArray alloc] initWithObjects:[PcsxrPluginHandler class], [PcsxrMemCardHandler class], [PcsxrFreezeStateHandler class], [PcsxrDiscHandler class], nil];
}
BOOL isHandled = NO;
for (Class fileHandler in handlers) {
NSObject<PcsxrFileHandle> *hand = [[fileHandler alloc] init];

View File

@ -15,7 +15,11 @@
+ (NSArray *)supportedUTIs
{
return [NSArray arrayWithObjects:@"com.alcohol-soft.mdfdisc", @"com.goldenhawk.cdrwin-cuesheet", @"com.apple.disk-image-ndif", @"public.iso-image", nil];
static NSArray *utisupport = nil;
if (utisupport == nil) {
utisupport = [[NSArray alloc] initWithObjects:@"com.alcohol-soft.mdfdisc", @"com.goldenhawk.cdrwin-cuesheet", @"com.apple.disk-image-ndif", @"public.iso-image", nil];
}
return utisupport;
}
- (BOOL)handleFile:(NSString *)theFile

View File

@ -14,7 +14,11 @@
+ (NSArray *)supportedUTIs
{
return [NSArray arrayWithObject:@"com.codeplex.pcsxr.freeze"];
static NSArray *utisupport = nil;
if (utisupport == nil) {
utisupport = [[NSArray alloc] initWithObjects:@"com.codeplex.pcsxr.freeze", nil];
}
return utisupport;
}
- (BOOL)handleFile:(NSString *)theFile

View File

@ -13,7 +13,11 @@
+ (NSArray *)supportedUTIs
{
return [NSArray arrayWithObject:@"com.codeplex.pcsxr.memcard"];
static NSArray *utisupport = nil;
if (utisupport == nil) {
utisupport = [[NSArray alloc] initWithObjects:@"com.codeplex.pcsxr.memcard", nil];
}
return utisupport;
}
- (id)initWithWindow:(NSWindow *)window

View File

@ -12,7 +12,11 @@
+ (NSArray *)supportedUTIs
{
return [NSArray arrayWithObject:@"com.codeplex.pcsxr.plugin"];
static NSArray *utisupport = nil;
if (utisupport == nil) {
utisupport = [[NSArray alloc] initWithObjects:@"com.codeplex.pcsxr.plugin", nil];
}
return utisupport;
}
- (id)initWithWindow:(NSWindow *)window