summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2012-05-23 23:20:57 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2012-05-23 23:20:57 +0000
commit659ecb8f16705b22ab7941922b61fcd1831ead28 (patch)
tree73957e832e707d09054c99697616dd4d9cc3e013
parent3e2fd08a49abdf6be2572449116486807786ef7f (diff)
downloadpcsxr-659ecb8f16705b22ab7941922b61fcd1831ead28.tar.gz
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
-rw-r--r--macosx/PcsxrController.m5
-rw-r--r--macosx/PcsxrDiscHandler.m6
-rw-r--r--macosx/PcsxrFreezeStateHandler.m6
-rw-r--r--macosx/PcsxrMemCardHandler.m6
-rw-r--r--macosx/PcsxrPluginHandler.m6
5 files changed, 24 insertions, 5 deletions
diff --git a/macosx/PcsxrController.m b/macosx/PcsxrController.m
index e774aef5..210f12ac 100644
--- a/macosx/PcsxrController.m
+++ b/macosx/PcsxrController.m
@@ -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];
diff --git a/macosx/PcsxrDiscHandler.m b/macosx/PcsxrDiscHandler.m
index 87031435..83a83e8d 100644
--- a/macosx/PcsxrDiscHandler.m
+++ b/macosx/PcsxrDiscHandler.m
@@ -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
diff --git a/macosx/PcsxrFreezeStateHandler.m b/macosx/PcsxrFreezeStateHandler.m
index 934aff19..8ecafae6 100644
--- a/macosx/PcsxrFreezeStateHandler.m
+++ b/macosx/PcsxrFreezeStateHandler.m
@@ -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
diff --git a/macosx/PcsxrMemCardHandler.m b/macosx/PcsxrMemCardHandler.m
index b8d3cdd9..934414d2 100644
--- a/macosx/PcsxrMemCardHandler.m
+++ b/macosx/PcsxrMemCardHandler.m
@@ -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
diff --git a/macosx/PcsxrPluginHandler.m b/macosx/PcsxrPluginHandler.m
index 395c2461..a2a447d4 100644
--- a/macosx/PcsxrPluginHandler.m
+++ b/macosx/PcsxrPluginHandler.m
@@ -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