mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-11 22:42:31 +02:00
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:
@@ -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__ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user