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:
parent
6d927d7472
commit
cf85a26a30
8 changed files with 34 additions and 78 deletions
|
@ -35,8 +35,8 @@
|
|||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
{ @autoreleasepool
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
const char* baseType = [[[bundle infoDictionary] objectForKey:@"SDL_FILESYSTEM_BASE_DIR_TYPE"] UTF8String];
|
||||
const char *base = NULL;
|
||||
|
@ -62,14 +62,13 @@ SDL_GetBasePath(void)
|
|||
}
|
||||
}
|
||||
|
||||
[pool release];
|
||||
return retval;
|
||||
}
|
||||
}}
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
{ @autoreleasepool
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
|
||||
char *retval = NULL;
|
||||
|
||||
|
@ -96,9 +95,8 @@ SDL_GetPrefPath(const char *org, const char *app)
|
|||
}
|
||||
}
|
||||
|
||||
[pool release];
|
||||
return retval;
|
||||
}
|
||||
}}
|
||||
|
||||
#endif /* SDL_FILESYSTEM_COCOA */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue