Fixed 2680 - OSX: Replace NSAutoreleasePool with @autoreleasepool

Tim McDaniel

This patch replaces all use of NSAutoreleasePool with the Apple recommended @autoreleasepool.  @autoreleasepool is supposedly more efficient, and since it is scope based it can't be accidentally not released.
This commit is contained in:
Sam Lantinga
2014-08-17 15:07:00 -07:00
parent 5e50180415
commit d1cc47b337
8 changed files with 34 additions and 78 deletions

View File

@@ -33,6 +33,7 @@
Also, note the bundle layouts are different for iPhone and Mac.
*/
FILE* SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode)
{ @autoreleasepool
{
FILE* fp = NULL;
@@ -41,9 +42,6 @@ FILE* SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode)
return fopen(file, mode);
}
NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
NSFileManager* file_manager = [NSFileManager defaultManager];
NSString* resource_path = [[NSBundle mainBundle] resourcePath];
@@ -57,10 +55,8 @@ FILE* SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode)
fp = fopen(file, mode);
}
[autorelease_pool drain];
return fp;
}
}}
#endif /* __MACOSX__ */